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

Method solve

src/engine/Engine.cpp:190–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190bool Engine::solve( double timeoutInSeconds )
191{
192 SignalHandler::getInstance()->initialize();
193 SignalHandler::getInstance()->registerClient( this );
194
195 // Register the boundManager with all the PL constraints
196 for ( auto &plConstraint : _plConstraints )
197 plConstraint->registerBoundManager( &_boundManager );
198 for ( auto &nlConstraint : _nlConstraints )
199 nlConstraint->registerBoundManager( &_boundManager );
200
201 // Before encoding, make sure all valid constraints are applied.
202 applyAllValidConstraintCaseSplits();
203
204 if ( _solveWithMILP )
205 return solveWithMILPEncoding( timeoutInSeconds );
206
207 updateDirections();
208 if ( _lpSolverType == LPSolverType::NATIVE )
209 storeInitialEngineState();
210 else if ( _lpSolverType == LPSolverType::GUROBI )
211 {
212 ENGINE_LOG( "Encoding convex relaxation into Gurobi..." );
213 _gurobi = std::unique_ptr<GurobiWrapper>( new GurobiWrapper() );
214 _tableau->setGurobi( &( *_gurobi ) );
215 _milpEncoder = std::unique_ptr<MILPEncoder>( new MILPEncoder( *_tableau ) );
216 _milpEncoder->setStatistics( &_statistics );
217 _milpEncoder->encodeInputQuery( *_gurobi, *_preprocessedQuery, true );
218 ENGINE_LOG( "Encoding convex relaxation into Gurobi - done" );
219 }
220
221 mainLoopStatistics();
222 if ( _verbosity > 0 )
223 {
224 printf( "\nEngine::solve: Initial statistics\n" );
225 _statistics.print();
226 printf( "\n---\n" );
227 }
228
229 bool splitJustPerformed = true;
230 struct timespec mainLoopStart = TimeUtils::sampleMicro();
231 while ( true )
232 {
233 struct timespec mainLoopEnd = TimeUtils::sampleMicro();
234 _statistics.incLongAttribute( Statistics::TIME_MAIN_LOOP_MICRO,
235 TimeUtils::timePassed( mainLoopStart, mainLoopEnd ) );
236 mainLoopStart = mainLoopEnd;
237
238 if ( shouldExitDueToTimeout( timeoutInSeconds ) )
239 {
240 if ( _verbosity > 0 )
241 {
242 printf( "\n\nEngine: quitting due to timeout...\n\n" );
243 printf( "Final statistics:\n" );
244 _statistics.print();
245 }
246
247 _exitCode = Engine::TIMEOUT;

Callers 15

mainFunction · 0.45
mainFunction · 0.45
run_testMethod · 0.45
test_sat_vnncompMethod · 0.45
test_unsat_vnncompMethod · 0.45
mainFunction · 0.45
solveWithMILPEncodingMethod · 0.45
runMethod · 0.45
solveQueryMethod · 0.45
test_disjunction_1Method · 0.45

Calls 15

StringfClass · 0.85
registerClientMethod · 0.80
encodeInputQueryMethod · 0.80
incLongAttributeMethod · 0.80
getLongAttributeMethod · 0.80
propagateTighteningsMethod · 0.80
performSplitMethod · 0.80
setSATSolutionFlagMethod · 0.80
toggleOptimizationMethod · 0.80
popSplitMethod · 0.80
getCodeMethod · 0.80

Tested by 15

run_testMethod · 0.36
test_sat_vnncompMethod · 0.36
test_unsat_vnncompMethod · 0.36
test_disjunction_1Method · 0.36
test_disjunction_2Method · 0.36
test_infesiableMethod · 0.36
test_fesiableMethod · 0.36
test_max_infeasibleMethod · 0.36
test_max_fesibleMethod · 0.36