@@ -178,6 +178,10 @@ lbool scip_solve_async(ScipSolver *scip_solver, MsSolver *solver)
178178 SCIP_SOL *sol = SCIPgetBestSol (scip_solver->scip );
179179 assert (sol != nullptr );
180180 // MY_SCIP_CALL(SCIPprintSol(scip_solver->scip, sol, nullptr, FALSE));
181+ SCIP_Bool feasible = FALSE ;
182+ MY_SCIP_CALL (SCIPcheckSolOrig (scip_solver->scip , sol, &feasible, FALSE , FALSE ));
183+ if (!feasible) { found_opt = l_Undef; goto clean_and_return; }
184+
181185 best_value = scip_solver->obj_offset + long (round (SCIPgetSolOrigObj (scip_solver->scip , sol)));
182186 for (Var x = 0 ; x < (int )scip_solver->vars .size (); x++)
183187 {
@@ -236,7 +240,9 @@ lbool scip_solve_async(ScipSolver *scip_solver, MsSolver *solver)
236240 SCIP_SOL *sol = SCIPgetBestSol (scip_solver->scip );
237241 if (sol != nullptr ) {
238242 Int scip_sol = (scip_solver->obj_offset + int64_t (round (SCIPgetSolOrigObj (scip_solver->scip , sol))))/gcd;
239- if (scip_sol < solver->best_goalvalue ) {
243+ SCIP_Bool feasible = FALSE ;
244+ MY_SCIP_CALL (SCIPcheckSolOrig (scip_solver->scip , sol, &feasible, FALSE , FALSE ));
245+ if (feasible && scip_sol < solver->best_goalvalue ) {
240246 for (Var x = 0 ; x < (int )scip_solver->vars .size (); x++)
241247 if (scip_solver->vars [x] != nullptr ) {
242248 SCIP_Real v = SCIPgetSolVal (scip_solver->scip , sol, scip_solver->vars [x]);
@@ -280,7 +286,7 @@ lbool scip_solve_async(ScipSolver *scip_solver, MsSolver *solver)
280286 std::lock_guard<std::mutex> lck (optsol_mtx);
281287 char test = OPT_NONE;
282288 if (opt_finder.compare_exchange_strong (test, OPT_SCIP)) {
283- if (!solver->ipamir_used || opt_verbosity > 0 )
289+ if (!scip_solver-> pb_decision_problem && (! solver->ipamir_used || opt_verbosity > 0 ) )
284290 reportf (" SCIP optimum (rounded): %" PRId64 " \n " , best_value);
285291 solver->best_goalvalue = best_value;
286292 vec<lbool> opt_model (scip_solver->model .size ());
@@ -293,14 +299,14 @@ lbool scip_solve_async(ScipSolver *scip_solver, MsSolver *solver)
293299 solver->best_goalvalue = (solver->fixed_goalval + evalGoal (solver->soft_cls , solver->best_model , soft_unsat)) * solver->goal_gcd ;
294300
295301 extern bool opt_satisfiable_out;
296- opt_satisfiable_out = false ;
302+ opt_satisfiable_out = scip_solver-> pb_decision_problem ;
297303
298304 if (opt_verbosity >= 1 ) {
299305 printScipStats (scip_solver);
300306 solver->printStats (false );
301307 }
302308 if (!solver->ipamir_used ) {
303- outputResult (*solver, true );
309+ outputResult (*solver, !scip_solver-> pb_decision_problem );
304310 std::this_thread::sleep_for (std::chrono::milliseconds (10 ));
305311 // MY_SCIP_CALL(SCIPfree(&scip_solver->scip));
306312 std::_Exit (30 );
@@ -372,9 +378,16 @@ lbool MsSolver::scip_init(ScipSolver &scip_solver, int sat_orig_vars)
372378 if (opt_verbosity <= 1 )
373379 MY_SCIP_CALL (SCIPsetIntParam (scip, " display/verblevel" , 0 ));
374380 if (declared_intsize > 0 && declared_intsize < 49 ) {
375- SCIP_Real feastol = pow (0.5 ,declared_intsize);
376- if (feastol < 1e-06 )
377- MY_SCIP_CALL (SCIPsetRealParam (scip, " numerics/feastol" , feastol));
381+ SCIP_Real feastol, newfeastol = pow (0.5 ,declared_intsize), epsilon, sumepsilon;
382+ MY_SCIP_CALL (SCIPgetRealParam (scip, " numerics/feastol" , &feastol));
383+ MY_SCIP_CALL (SCIPgetRealParam (scip, " numerics/epsilon" , &epsilon));
384+ MY_SCIP_CALL (SCIPgetRealParam (scip, " numerics/sumepsilon" , &sumepsilon));
385+ if (newfeastol < feastol)
386+ MY_SCIP_CALL (SCIPsetRealParam (scip, " numerics/feastol" , newfeastol));
387+ if (newfeastol < epsilon)
388+ MY_SCIP_CALL (SCIPsetRealParam (scip, " numerics/epsilon" , newfeastol));
389+ if (newfeastol < sumepsilon)
390+ MY_SCIP_CALL (SCIPsetRealParam (scip, " numerics/sumepsilon" , newfeastol));
378391 }
379392 scip_solver.model .resize (sat_orig_vars);
380393 for (Var x = sat_orig_vars - 1 ; x >= 0 ; x--) scip_solver.model [x] = sat_solver.value (x);
@@ -499,7 +512,7 @@ lbool MsSolver::scip_solve(const Minisat::vec<Lit> *assump_ps,
499512 (opt_scip_parallel? " in a separate thread" : " " ), opt_scip_cpu);
500513
501514 scip_solver.obj_offset = obj_offset;
502- if (opt_scip_delay > cpuTime () + 1 ) {
515+ if (opt_scip_delay > cpuTime () + 10 ) {
503516 scip_solver.must_be_started = true ;
504517 if (!ipamir_used || opt_verbosity > 0 ) reportf (" SCIP start delayed for at least %.0fs\n " , opt_scip_delay - cpuTime ());
505518 return l_Undef;
0 commit comments