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

Method getCostFunctionComponent

src/engine/MaxConstraint.cpp:591–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

589}
590
591void MaxConstraint::getCostFunctionComponent( LinearExpression &cost, PhaseStatus phase ) const
592{
593 // If the constraint is not active or is fixed, it contributes nothing
594 if ( !isActive() || phaseFixed() )
595 return;
596
597 if ( phase == MAX_PHASE_ELIMINATED )
598 {
599 // The cost term corresponding to this phase is f - maxValueOfEliminated.
600 if ( !cost._addends.exists( _f ) )
601 cost._addends[_f] = 0;
602 cost._addends[_f] = cost._addends[_f] + 1;
603 cost._constant -= _maxValueOfEliminatedPhases;
604 }
605 else
606 {
607 unsigned element = phaseToVariable( phase );
608 unsigned aux = _elementToAux[element];
609 if ( !cost._addends.exists( aux ) )
610 cost._addends[aux] = 0;
611 cost._addends[aux] += 1;
612 }
613}
614
615PhaseStatus
616MaxConstraint::getPhaseStatusInAssignment( const Map<unsigned, double> &assignment ) const

Calls 1

existsMethod · 0.45