| 103 | } |
| 104 | |
| 105 | unsigned BoundManager::registerNewVariable() |
| 106 | { |
| 107 | ASSERT( _size == _storedLowerBounds.size() ); |
| 108 | ASSERT( _size == _storedUpperBounds.size() ); |
| 109 | ASSERT( _size == _tightenedLower.size() ); |
| 110 | ASSERT( _size == _tightenedUpper.size() ); |
| 111 | |
| 112 | unsigned newVar = _size++; |
| 113 | |
| 114 | if ( _allocated < _size ) |
| 115 | { |
| 116 | double *oldLowerBounds = _upperBounds; |
| 117 | double *oldUpperBounds = _lowerBounds; |
| 118 | |
| 119 | allocateLocalBounds( 2 * _allocated ); |
| 120 | std::memcpy( _lowerBounds, oldLowerBounds, _allocated ); |
| 121 | std::memcpy( _upperBounds, oldUpperBounds, _allocated ); |
| 122 | _allocated *= 2; |
| 123 | |
| 124 | delete[] oldLowerBounds; |
| 125 | delete[] oldUpperBounds; |
| 126 | } |
| 127 | |
| 128 | _storedLowerBounds.append( new ( true ) CDO<double>( &_context ) ); |
| 129 | _storedUpperBounds.append( new ( true ) CDO<double>( &_context ) ); |
| 130 | _tightenedLower.append( new ( true ) CDO<bool>( &_context ) ); |
| 131 | _tightenedUpper.append( new ( true ) CDO<bool>( &_context ) ); |
| 132 | |
| 133 | *_storedLowerBounds[newVar] = FloatUtils::negativeInfinity(); |
| 134 | *_storedUpperBounds[newVar] = FloatUtils::infinity(); |
| 135 | *_tightenedLower[newVar] = false; |
| 136 | *_tightenedUpper[newVar] = false; |
| 137 | |
| 138 | return newVar; |
| 139 | } |
| 140 | |
| 141 | unsigned BoundManager::getNumberOfVariables() const |
| 142 | { |