30 #define NLPI_NAME "all" 31 #define NLPI_DESC "NLP interface that uses all available NLP interfaces" 32 #define NLPI_PRIORITY -3000 54 static int _nnlps = 0;
78 assert(sourcenlpi != NULL);
79 assert(targetnlpi != NULL);
82 assert(sourcedata != NULL);
83 assert(sourcedata->nnlpis > 1);
84 assert(sourcedata->nlpis[0] != NULL);
88 assert(*targetnlpi != NULL);
108 assert(nlpi != NULL);
111 assert(data != NULL);
113 for( i = data->nnlpis - 1; i >= 0; --i )
136 assert(nlpi != NULL);
154 assert(nlpi != NULL);
155 assert(problem != NULL);
158 assert(data != NULL);
161 if( *problem == NULL )
167 (*problem)->nnlpiproblems = data->nnlpis;
169 for( i = 0; i < data->nnlpis; ++i )
171 assert(data->nlpis[i] != NULL);
190 assert(nlpi != NULL);
191 assert(problem != NULL);
192 assert(*problem != NULL);
195 assert(data != NULL);
197 for( i = 0; i < data->nnlpis; ++i )
199 assert(data->nlpis[i] != NULL);
222 assert(nlpi != NULL);
223 assert(problem != NULL);
245 assert(nlpidata != NULL);
247 for( i = 0; i < nlpidata->nnlpis; ++i )
249 assert(nlpidata->nlpis[i] != NULL);
250 assert(problem->nlpiproblems[i] != NULL);
304 assert(nlpidata != NULL);
306 for( i = 0; i < nlpidata->nnlpis; ++i )
308 assert(nlpidata->nlpis[i] != NULL);
309 assert(problem->nlpiproblems[i] != NULL);
312 lininds, linvals, nquadelems, quadelems, exprvaridxs, exprtrees, names) );
352 assert(nlpidata != NULL);
354 for( i = 0; i < nlpidata->nnlpis; ++i )
356 assert(nlpidata->nlpis[i] != NULL);
357 assert(problem->nlpiproblems[i] != NULL);
360 quadelems, exprvaridxs, exprtree, constant) );
383 assert(nlpidata != NULL);
385 for( i = 0; i < nlpidata->nnlpis; ++i )
387 assert(nlpidata->nlpis[i] != NULL);
388 assert(problem->nlpiproblems[i] != NULL);
413 assert(nlpidata != NULL);
415 for( i = 0; i < nlpidata->nnlpis; ++i )
417 assert(nlpidata->nlpis[i] != NULL);
418 assert(problem->nlpiproblems[i] != NULL);
445 assert(nlpidata != NULL);
449 for( i = 0; i < nlpidata->nnlpis; ++i )
451 assert(nlpidata->nlpis[i] != NULL);
452 assert(problem->nlpiproblems[i] != NULL);
454 if( i < nlpidata->nnlpis -1 )
495 assert(nlpidata != NULL);
499 for( i = 0; i < nlpidata->nnlpis; ++i )
501 assert(nlpidata->nlpis[i] != NULL);
502 assert(problem->nlpiproblems[i] != NULL);
504 if( i < nlpidata->nnlpis - 1 )
544 assert(nlpidata != NULL);
546 for( i = 0; i < nlpidata->nnlpis; ++i )
548 assert(nlpidata->nlpis[i] != NULL);
549 assert(problem->nlpiproblems[i] != NULL);
575 assert(nlpidata != NULL);
577 for( i = 0; i < nlpidata->nnlpis; ++i )
579 assert(nlpidata->nlpis[i] != NULL);
580 assert(problem->nlpiproblems[i] != NULL);
604 assert(nlpidata != NULL);
606 for( i = 0; i < nlpidata->nnlpis; ++i )
608 assert(nlpidata->nlpis[i] != NULL);
609 assert(problem->nlpiproblems[i] != NULL);
635 assert(nlpidata != NULL);
637 for( i = 0; i < nlpidata->nnlpis; ++i )
639 assert(nlpidata->nlpis[i] != NULL);
640 assert(problem->nlpiproblems[i] != NULL);
662 assert(nlpidata != NULL);
664 for( i = 0; i < nlpidata->nnlpis; ++i )
666 assert(nlpidata->nlpis[i] != NULL);
667 assert(problem->nlpiproblems[i] != NULL);
692 assert(nlpidata != NULL);
694 for( i = 0; i < nlpidata->nnlpis; ++i )
696 assert(nlpidata->nlpis[i] != NULL);
697 assert(problem->nlpiproblems[i] != NULL);
700 varlbdualvalues, varubdualvalues) );
723 assert(nlpidata != NULL);
726 problem->bestidx = 0;
734 for( i = 0; i < nlpidata->nnlpis; ++i )
741 assert(nlpidata->nlpis[i] != NULL);
742 assert(problem->nlpiproblems[i] != NULL);
756 NULL, NULL, NULL, NULL, &solval) );
757 assert(solval != infinity);
761 if( termstat < besttermstat )
769 else if( solval < bestsolval )
775 besttermstat = termstat;
776 bestsolstat = solstat;
778 problem->bestidx = i;
781 #ifdef SCIP_STATISTIC 788 _nnlps,
SCIPnlpiGetName(nlpidata->nlpis[i]), termstat, solstat, solval,
794 #ifdef SCIP_STATISTIC 815 assert(nlpidata != NULL);
816 assert(nlpidata->nlpis != NULL);
817 assert(nlpidata->nlpis[problem->bestidx] != NULL);
818 assert(problem->nlpiproblems != NULL);
819 assert(problem->nlpiproblems[problem->bestidx] != NULL);
822 return SCIPnlpiGetSolstat(nlpidata->nlpis[problem->bestidx], problem->nlpiproblems[problem->bestidx]);
839 assert(nlpidata != NULL);
840 assert(nlpidata->nlpis != NULL);
841 assert(nlpidata->nlpis[problem->bestidx] != NULL);
842 assert(problem->nlpiproblems != NULL);
843 assert(problem->nlpiproblems[problem->bestidx] != NULL);
846 return SCIPnlpiGetTermstat(nlpidata->nlpis[problem->bestidx], problem->nlpiproblems[problem->bestidx]);
871 assert(nlpidata != NULL);
872 assert(nlpidata->nlpis != NULL);
873 assert(nlpidata->nlpis[problem->bestidx] != NULL);
874 assert(problem->nlpiproblems != NULL);
875 assert(problem->nlpiproblems[problem->bestidx] != NULL);
879 primalvalues, consdualvalues, varlbdualvalues, varubdualvalues, objval) );
900 assert(nlpidata != NULL);
901 assert(nlpidata->nlpis != NULL);
902 assert(nlpidata->nlpis[problem->bestidx] != NULL);
903 assert(problem->nlpiproblems != NULL);
904 assert(problem->nlpiproblems[problem->bestidx] != NULL);
982 assert(nlpidata != NULL);
983 assert(nlpidata->nlpis != NULL);
984 assert(nlpidata->nlpis[0] != NULL);
1007 assert(nlpidata != NULL);
1009 for( i = 0; i < nlpidata->nnlpis; ++i )
1011 assert(nlpidata->nlpis[i] != NULL);
1012 assert(problem->nlpiproblems[i] != NULL);
1037 assert(nlpidata != NULL);
1038 assert(nlpidata->nlpis != NULL);
1039 assert(nlpidata->nlpis[0] != NULL);
1062 assert(nlpidata != NULL);
1064 for( i = 0; i < nlpidata->nnlpis; ++i )
1066 assert(nlpidata->nlpis[i] != NULL);
1074 assert(problem->nlpiproblems != NULL);
1075 assert(problem->nlpiproblems[i] != NULL);
1101 assert(nlpidata != NULL);
1102 assert(nlpidata->nlpis != NULL);
1103 assert(nlpidata->nlpis[0] != NULL);
1126 assert(nlpidata != NULL);
1128 for( i = 0; i < nlpidata->nnlpis; ++i )
1130 assert(nlpidata->nlpis[i] != NULL);
1131 assert(problem->nlpiproblems[i] != NULL);
1151 assert(nlpi != NULL);
1154 assert(nlpidata != NULL);
1156 nlpidata->messagehdlr = messagehdlr;
1158 for( i = 0; i < nlpidata->nnlpis; ++i )
1160 assert(nlpidata->nlpis[i] != NULL);
1183 assert(blkmem != NULL);
1184 assert(nlpi != NULL);
1185 assert(nlpis != NULL || nnlpis == 0);
1193 assert(nlpis != NULL);
1198 nlpidata->blkmem = blkmem;
1203 for( i = 0; i < nnlpis; ++i )
1207 nlpidata->nnlpis = nnlpis;
1212 nlpiCopyAll, nlpiFreeAll, nlpiGetSolverPointerAll,
1213 nlpiCreateProblemAll, nlpiFreeProblemAll, nlpiGetProblemPointerAll,
1214 nlpiAddVarsAll, nlpiAddConstraintsAll, nlpiSetObjectiveAll,
1215 nlpiChgVarBoundsAll, nlpiChgConsSidesAll, nlpiDelVarSetAll, nlpiDelConstraintSetAll,
1216 nlpiChgLinearCoefsAll, nlpiChgQuadraticCoefsAll, nlpiChgExprtreeAll, nlpiChgNonlinCoefAll,
1217 nlpiChgObjConstantAll, nlpiSetInitialGuessAll, nlpiSolveAll, nlpiGetSolstatAll, nlpiGetTermstatAll,
1218 nlpiGetSolutionAll, nlpiGetStatisticsAll,
1219 nlpiGetWarmstartSizeAll, nlpiGetWarmstartMemoAll, nlpiSetWarmstartMemoAll,
1220 nlpiGetIntParAll, nlpiSetIntParAll, nlpiGetRealParAll, nlpiSetRealParAll, nlpiGetStringParAll, nlpiSetStringParAll,
1221 nlpiSetMessageHdlrAll,
#define BMSfreeBlockMemoryArrayNull(mem, ptr, num)
SCIP_RETCODE SCIPnlpiGetStatistics(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPSTATISTICS *statistics)
enum SCIP_NlpTermStat SCIP_NLPTERMSTAT
static SCIP_DECL_NLPISETREALPAR(nlpiSetRealParAll)
static SCIP_DECL_NLPIGETWARMSTARTSIZE(nlpiGetWarmstartSizeAll)
SCIP_Real SCIPnlpStatisticsGetTotalTime(SCIP_NLPSTATISTICS *statistics)
internal methods for NLPI solver interfaces
SCIP_RETCODE SCIPnlpiSetStringPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, const char *sval)
static SCIP_DECL_NLPICHGNONLINCOEF(nlpiChgNonlinCoefAll)
SCIP_RETCODE SCIPnlpiCreateProblem(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM **problem, const char *name)
SCIP_RETCODE SCIPnlpiGetSolution(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_Real **primalvalues, SCIP_Real **consdualvalues, SCIP_Real **varlbdualvalues, SCIP_Real **varubdualvalues, SCIP_Real *objval)
SCIP_RETCODE SCIPnlpiDelVarSet(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int *dstats, int dstatssize)
static SCIP_DECL_NLPISETSTRINGPAR(nlpiSetStringParAll)
static SCIP_DECL_NLPICHGEXPRTREE(nlpiChgExprtreeAll)
SCIP_RETCODE SCIPnlpiAddConstraints(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nconss, const SCIP_Real *lhss, const SCIP_Real *rhss, const int *nlininds, int *const *lininds, SCIP_Real *const *linvals, const int *nquadelems, SCIP_QUADELEM *const *quadelems, int *const *exprvaridxs, SCIP_EXPRTREE *const *exprtrees, const char **names)
static SCIP_DECL_NLPISETMESSAGEHDLR(nlpiSetMessageHdlrAll)
enum SCIP_Retcode SCIP_RETCODE
#define SCIPstatisticMessage
const char * SCIPnlpiGetName(SCIP_NLPI *nlpi)
SCIP_NLPIPROBLEM ** nlpiproblems
SCIP_RETCODE SCIPnlpiSetMessageHdlr(SCIP_NLPI *nlpi, SCIP_MESSAGEHDLR *messagehdlr)
SCIP_RETCODE SCIPnlpiChgVarBounds(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nvars, const int *indices, const SCIP_Real *lbs, const SCIP_Real *ubs)
static SCIP_DECL_NLPICOPY(nlpiCopyAll)
SCIP_RETCODE SCIPnlpiSolve(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
SCIP_RETCODE SCIPnlpiGetStringPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, const char **sval)
static SCIP_DECL_NLPIGETREALPAR(nlpiGetRealParAll)
SCIP_RETCODE SCIPnlpiAddVars(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nvars, const SCIP_Real *lbs, const SCIP_Real *ubs, const char **varnames)
SCIP_RETCODE SCIPnlpiFree(SCIP_NLPI **nlpi)
static SCIP_DECL_NLPIGETPROBLEMPOINTER(nlpiGetProblemPointerAll)
static SCIP_DECL_NLPIGETSOLSTAT(nlpiGetSolstatAll)
struct SCIP_NlpiData SCIP_NLPIDATA
enum SCIP_NlpSolStat SCIP_NLPSOLSTAT
static SCIP_DECL_NLPISOLVE(nlpiSolveAll)
SCIP_RETCODE SCIPnlpiChgConsSides(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nconss, const int *indices, const SCIP_Real *lhss, const SCIP_Real *rhss)
static SCIP_DECL_NLPISETOBJECTIVE(nlpiSetObjectiveAll)
static SCIP_DECL_NLPISETINTPAR(nlpiSetIntParAll)
SCIP_RETCODE SCIPnlpiSetInitialGuess(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_Real *primalvalues, SCIP_Real *consdualvalues, SCIP_Real *varlbdualvalues, SCIP_Real *varubdualvalues)
static SCIP_DECL_NLPIGETSOLUTION(nlpiGetSolutionAll)
static SCIP_DECL_NLPICHGLINEARCOEFS(nlpiChgLinearCoefsAll)
SCIP_NLPSOLSTAT SCIPnlpiGetSolstat(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
SCIP_RETCODE SCIPnlpiSetObjective(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nlins, const int *lininds, const SCIP_Real *linvals, int nquadelems, const SCIP_QUADELEM *quadelems, const int *exprvaridxs, const SCIP_EXPRTREE *exprtree, const SCIP_Real constant)
static SCIP_DECL_NLPIGETSTATISTICS(nlpiGetStatisticsAll)
SCIP_RETCODE SCIPnlpiDelConsSet(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int *dstats, int dstatssize)
#define BMSfreeBlockMemory(mem, ptr)
SCIP_RETCODE SCIPnlpiFreeProblem(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM **problem)
SCIP_RETCODE SCIPnlpiCreate(SCIP_NLPI **nlpi, const char *name, const char *description, int priority, SCIP_DECL_NLPICOPY((*nlpicopy)), SCIP_DECL_NLPIFREE((*nlpifree)), SCIP_DECL_NLPIGETSOLVERPOINTER((*nlpigetsolverpointer)), SCIP_DECL_NLPICREATEPROBLEM((*nlpicreateproblem)), SCIP_DECL_NLPIFREEPROBLEM((*nlpifreeproblem)), SCIP_DECL_NLPIGETPROBLEMPOINTER((*nlpigetproblempointer)), SCIP_DECL_NLPIADDVARS((*nlpiaddvars)), SCIP_DECL_NLPIADDCONSTRAINTS((*nlpiaddconstraints)), SCIP_DECL_NLPISETOBJECTIVE((*nlpisetobjective)), SCIP_DECL_NLPICHGVARBOUNDS((*nlpichgvarbounds)), SCIP_DECL_NLPICHGCONSSIDES((*nlpichgconssides)), SCIP_DECL_NLPIDELVARSET((*nlpidelvarset)), SCIP_DECL_NLPIDELCONSSET((*nlpidelconsset)), SCIP_DECL_NLPICHGLINEARCOEFS((*nlpichglinearcoefs)), SCIP_DECL_NLPICHGQUADCOEFS((*nlpichgquadcoefs)), SCIP_DECL_NLPICHGEXPRTREE((*nlpichgexprtree)), SCIP_DECL_NLPICHGNONLINCOEF((*nlpichgnonlincoef)), SCIP_DECL_NLPICHGOBJCONSTANT((*nlpichgobjconstant)), SCIP_DECL_NLPISETINITIALGUESS((*nlpisetinitialguess)), SCIP_DECL_NLPISOLVE((*nlpisolve)), SCIP_DECL_NLPIGETSOLSTAT((*nlpigetsolstat)), SCIP_DECL_NLPIGETTERMSTAT((*nlpigettermstat)), SCIP_DECL_NLPIGETSOLUTION((*nlpigetsolution)), SCIP_DECL_NLPIGETSTATISTICS((*nlpigetstatistics)), SCIP_DECL_NLPIGETWARMSTARTSIZE((*nlpigetwarmstartsize)), SCIP_DECL_NLPIGETWARMSTARTMEMO((*nlpigetwarmstartmemo)), SCIP_DECL_NLPISETWARMSTARTMEMO((*nlpisetwarmstartmemo)), SCIP_DECL_NLPIGETINTPAR((*nlpigetintpar)), SCIP_DECL_NLPISETINTPAR((*nlpisetintpar)), SCIP_DECL_NLPIGETREALPAR((*nlpigetrealpar)), SCIP_DECL_NLPISETREALPAR((*nlpisetrealpar)), SCIP_DECL_NLPIGETSTRINGPAR((*nlpigetstringpar)), SCIP_DECL_NLPISETSTRINGPAR((*nlpisetstringpar)), SCIP_DECL_NLPISETMESSAGEHDLR((*nlpisetmessagehdlr)), SCIP_NLPIDATA *nlpidata)
public data structures and miscellaneous methods
#define BMSallocBlockMemoryArray(mem, ptr, num)
SCIP_RETCODE SCIPnlpiCopy(BMS_BLKMEM *blkmem, SCIP_NLPI *sourcenlpi, SCIP_NLPI **targetnlpi)
static SCIP_DECL_NLPIDELCONSSET(nlpiDelConstraintSetAll)
SCIP_RETCODE SCIPnlpiSetIntPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, int ival)
#define BMSfreeBlockMemoryArray(mem, ptr, num)
SCIP_NLPTERMSTAT SCIPnlpiGetTermstat(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
static SCIP_DECL_NLPIGETSTRINGPAR(nlpiGetStringParAll)
static SCIP_DECL_NLPICHGOBJCONSTANT(nlpiChgObjConstantAll)
SCIP_RETCODE SCIPnlpiChgNonlinCoef(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int considx, int paramidx, SCIP_Real value)
SCIP_RETCODE SCIPnlpiChgQuadCoefs(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int idx, int nquadelems, const SCIP_QUADELEM *quadelems)
static SCIP_DECL_NLPIADDCONSTRAINTS(nlpiAddConstraintsAll)
static SCIP_DECL_NLPICHGQUADCOEFS(nlpiChgQuadraticCoefsAll)
#define BMScopyMemoryArray(ptr, source, num)
static SCIP_DECL_NLPIGETSOLVERPOINTER(nlpiGetSolverPointerAll)
#define BMSclearMemory(ptr)
static SCIP_DECL_NLPIGETTERMSTAT(nlpiGetTermstatAll)
static SCIP_DECL_NLPICREATEPROBLEM(nlpiCreateProblemAll)
static SCIP_DECL_NLPISETINITIALGUESS(nlpiSetInitialGuessAll)
static SCIP_DECL_NLPIFREE(nlpiFreeAll)
static SCIP_DECL_NLPISETWARMSTARTMEMO(nlpiSetWarmstartMemoAll)
SCIP_NLPIDATA * SCIPnlpiGetData(SCIP_NLPI *nlpi)
static SCIP_DECL_NLPIGETWARMSTARTMEMO(nlpiGetWarmstartMemoAll)
static SCIP_DECL_NLPICHGVARBOUNDS(nlpiChgVarBoundsAll)
int SCIPnlpStatisticsGetNIterations(SCIP_NLPSTATISTICS *statistics)
SCIP_RETCODE SCIPnlpiChgLinearCoefs(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, const int idx, int nvals, const int *varidxs, const SCIP_Real *vals)
SCIP_RETCODE SCIPcreateNlpSolverAll(BMS_BLKMEM *blkmem, SCIP_NLPI **nlpi, SCIP_NLPI **nlpis, int nnlpis)
SCIP_RETCODE SCIPnlpiChgExprtree(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int idxcons, const int *exprvaridxs, const SCIP_EXPRTREE *exprtree)
static SCIP_DECL_NLPIFREEPROBLEM(nlpiFreeProblemAll)
SCIP_RETCODE SCIPnlpiGetIntPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, int *ival)
static SCIP_DECL_NLPIGETINTPAR(nlpiGetIntParAll)
#define BMSallocBlockMemory(mem, ptr)
static SCIP_DECL_NLPICHGCONSSIDES(nlpiChgConsSidesAll)
struct BMS_BlkMem BMS_BLKMEM
static SCIP_DECL_NLPIDELVARSET(nlpiDelVarSetAll)
SCIP_RETCODE SCIPnlpiGetRealPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, SCIP_Real *dval)
SCIP_RETCODE SCIPnlpiChgObjConstant(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_Real objconstant)
static SCIP_DECL_NLPIADDVARS(nlpiAddVarsAll)
SCIP_RETCODE SCIPnlpiSetRealPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, SCIP_Real dval)