int SCIPSolver::solve(){ DBG("solve!%s\n", ""); if(!has_been_added) initialise(); if(_verbosity > 0 && _verbosity < 3){ // Do nothing extra } else if(_verbosity >= 3){ SCIP_CALL_EXC(SCIPprintOrigProblem(_scip, NULL, NULL, FALSE)); // SCIP_CALL_EXC(SCIPwriteOrigProblem(_scip, "scip.lp", "lp", TRUE)); } else { // disable scip output to stdout SCIP_CALL_EXC( SCIPsetMessagehdlr(_scip, NULL) ); } SCIP_CALL_EXC( SCIPsolve(_scip) ); SCIP_STATUS status = SCIPgetStatus(_scip); if( status == SCIP_STATUS_OPTIMAL ) return SAT; else if( status == SCIP_STATUS_INFEASIBLE ) return UNSAT; else return UNKNOWN; }
SCIP_RETCODE GamsScip::setupSCIP() { /* #ifdef COIN_HAS_OSICPX // change default LP solver to CPLEX, if license available if( gmo != NULL && checkCplexLicense(gmo, pal) ) { SCIP_CALL( SCIPlpiSwitchSetSolver(SCIP_LPISW_CPLEX) ); } #endif */ if( scip == NULL ) { // if called first time, create a new SCIP instance and include all plugins that we need and setup interface parameters SCIP_MESSAGEHDLR* messagehdlr; SCIP_NLPI* nlpiipopt; SCIP_CALL( SCIPcreate(&scip) ); // create and install our message handler SCIP_CALL( SCIPmessagehdlrCreate(&messagehdlr, FALSE, NULL, FALSE, GamsScipPrintLogStat, GamsScipPrintLog, GamsScipPrintLog, NULL, (SCIP_MESSAGEHDLRDATA*)gev) ); SCIP_CALL( SCIPsetMessagehdlr(scip, messagehdlr) ); SCIP_CALL( SCIPmessagehdlrRelease(&messagehdlr) ); SCIP_CALL( SCIPincludeDefaultPlugins(scip) ); SCIP_CALL( SCIPincludeReaderGmo(scip) ); SCIP_CALL( SCIPincludeEventHdlrSolveTrace(scip, gmo) ); /* SCIP_CALL( SCIPincludePropDefaultBounds(scip) ); */ if( ipoptlicensed ) { nlpiipopt = SCIPfindNlpi(scip, "ipopt"); if( nlpiipopt != NULL ) { SCIPsetModifiedDefaultSettingsIpopt(nlpiipopt, "linear_solver ma27\nlinear_system_scaling mc19\n"); SCIP_CALL( SCIPincludeExternalCodeInformation(scip, "HSL MA27 and MC19", "Harwell Subroutine Libraries (www.hsl.rl.ac.uk) from commercially supported Ipopt") ); } } /* else { nlpiipopt = SCIPfindNlpi(scip, "ipopt"); if( nlpiipopt != NULL ) { SCIPsetModifiedDefaultSettingsIpopt(nlpiipopt, "linear_solver mumps\n"); } } */ /* SCIP_CALL( SCIPaddBoolParam(scip, "gams/solvefinal", * "whether the problem should be solved with fixed discrete variables to get dual values", * NULL, FALSE, TRUE, NULL, NULL) ); */ SCIP_CALL( SCIPaddBoolParam(scip, "display/statistics", "whether to print statistics on a solve", NULL, FALSE, FALSE, NULL, NULL) ); SCIP_CALL( SCIPaddStringParam(scip, "gams/interactive", "command to be issued to the SCIP shell instead of issuing a solve command", NULL, FALSE, "", NULL, NULL) ); #if 0 SCIP_CALL( SCIPaddStringParam(scip, "constraints/attrfile", "name of file that specifies constraint attributes", NULL, FALSE, "", NULL, NULL) ); #endif /* SCIP_CALL( SCIPaddStringParam(scip, "lp/solver", "LP solver to use (clp, cplex, mosek, soplex, gurobi, xpress)", NULL, FALSE, SCIP_LPISW_SOLVERNAMES[SCIPlpiSwitchGetCurrentSolver()], GamsScipParamChgdLpSolver, NULL) ); */ } else { // if called before, only clear up problem and reset parameters SCIP_CALL( SCIPfreeProb(scip) ); SCIP_CALL( SCIPresetParams(scip) ); } /** pass current GMO into GMO reader, so it does not read instance from file */ SCIPsetGMOReaderGmo(scip, gmo); return SCIP_OKAY; }