Skip to content

Commit

Permalink
refactor: use previously set violated constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
ibeling committed Apr 4, 2018
1 parent 1e2bcae commit d0129c6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,7 @@ void Engine::performSimplexStep()

void Engine::fixViolatedPlConstraintIfPossible()
{
ASSERT( !_violatedPlConstraints.empty() );
PiecewiseLinearConstraint *violated = *_violatedPlConstraints.begin();
ASSERT( violated );

List<PiecewiseLinearConstraint::Fix> fixes = violated->getPossibleFixes();
List<PiecewiseLinearConstraint::Fix> fixes = _plConstraintToFix->getPossibleFixes();

// First, see if we can fix without pivoting
for ( const auto &fix : fixes )
Expand Down Expand Up @@ -655,7 +651,9 @@ bool Engine::allPlConstraintsHold()

void Engine::selectViolatedPlConstraint()
{
ASSERT( !_violatedPlConstraints.empty() );
_plConstraintToFix = *_violatedPlConstraints.begin();
ASSERT( _plConstraintToFix );
}

void Engine::reportPlViolation()
Expand Down

0 comments on commit d0129c6

Please sign in to comment.