MCPcopy Create free account
hub / github.com/NeuralNetworkVerification/Marabou / performSimplexStep

Method performSimplexStep

src/engine/Engine.cpp:627–826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625}
626
627bool Engine::performSimplexStep()
628{
629 // Statistics
630 _statistics.incLongAttribute( Statistics::NUM_SIMPLEX_STEPS );
631 struct timespec start = TimeUtils::sampleMicro();
632
633 /*
634 In order to increase numerical stability, we attempt to pick a
635 "good" entering/leaving combination, by trying to avoid tiny pivot
636 values. We do this as follows:
637
638 1. Pick an entering variable according to the strategy in use.
639 2. Find the entailed leaving variable.
640 3. If the combination is bad, go back to (1) and find the
641 next-best entering variable.
642 */
643
644 if ( _tableau->isOptimizing() )
645 _costFunctionManager->computeGivenCostFunction( _heuristicCost._addends );
646 if ( _costFunctionManager->costFunctionInvalid() )
647 _costFunctionManager->computeCoreCostFunction();
648 else
649 _costFunctionManager->adjustBasicCostAccuracy();
650
651 DEBUG( {
652 // Since we're performing a simplex step, there are out-of-bounds variables.
653 // Therefore, if the cost function is fresh, it should not be zero.
654 if ( _costFunctionManager->costFunctionJustComputed() )
655 {
656 const double *costFunction = _costFunctionManager->getCostFunction();
657 unsigned size = _tableau->getN() - _tableau->getM();
658 bool found = false;
659 for ( unsigned i = 0; i < size; ++i )
660 {
661 if ( !FloatUtils::isZero( costFunction[i] ) )
662 {
663 found = true;
664 break;
665 }
666 }
667
668 if ( !found )
669 {
670 printf( "Error! Have OOB vars but cost function is zero.\n"
671 "Recomputing cost function. New one is:\n" );
672 _costFunctionManager->computeCoreCostFunction();
673 _costFunctionManager->dumpCostFunction();
674 throw MarabouError( MarabouError::DEBUGGING_ERROR,
675 "Have OOB vars but cost function is zero" );
676 }
677 }
678 } );
679
680 // Obtain all eligible entering variables
681 List<unsigned> enteringVariableCandidates;
682 _tableau->getEntryCandidates( enteringVariableCandidates );
683
684 unsigned bestLeaving = 0;

Callers

nothing calls this directly

Calls 15

MarabouErrorClass · 0.85
absFunction · 0.85
incLongAttributeMethod · 0.80
isOptimizingMethod · 0.80
propagateTighteningsMethod · 0.80
costFunctionInvalidMethod · 0.45
getCostFunctionMethod · 0.45

Tested by

no test coverage detected