| 1482 | } |
| 1483 | |
| 1484 | void Tableau::setNonBasicAssignment( unsigned variable, double value, bool updateBasics ) |
| 1485 | { |
| 1486 | ASSERT( !_basicVariables.exists( variable ) ); |
| 1487 | |
| 1488 | unsigned nonBasic = _variableToIndex[variable]; |
| 1489 | double delta = value - _nonBasicAssignment[nonBasic]; |
| 1490 | _nonBasicAssignment[nonBasic] = value; |
| 1491 | |
| 1492 | // If we don't need to update the basics, we are done |
| 1493 | if ( !updateBasics ) |
| 1494 | return; |
| 1495 | |
| 1496 | // Treat this like a form of fake pivot and compute the change column |
| 1497 | _enteringVariable = nonBasic; |
| 1498 | computeChangeColumn(); |
| 1499 | |
| 1500 | // Update all the affected basic variables |
| 1501 | for ( unsigned i = 0; i < _m; ++i ) |
| 1502 | { |
| 1503 | _basicAssignment[i] -= _changeColumn[i] * delta; |
| 1504 | |
| 1505 | unsigned oldStatus = _basicStatus[i]; |
| 1506 | computeBasicStatus( i ); |
| 1507 | |
| 1508 | // If these updates resulted in a change to the status of some basic variable, |
| 1509 | // the cost function is invalidated |
| 1510 | if ( oldStatus != _basicStatus[i] ) |
| 1511 | _costFunctionManager->invalidateCostFunction(); |
| 1512 | |
| 1513 | _basicAssignmentStatus = ITableau::BASIC_ASSIGNMENT_UPDATED; |
| 1514 | } |
| 1515 | } |
| 1516 | |
| 1517 | void Tableau::dumpAssignment() |
| 1518 | { |
no test coverage detected