nlpi_all.c
Go to the documentation of this file.
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 #define NLPI_DESC "NLP interface that uses all available NLP interfaces" /* description of solver */
254 SCIP_CALL( SCIPnlpiAddVars(nlpidata->nlpis[i], problem->nlpiproblems[i], nvars, lbs, ubs, varnames) );
281 * indices are given w.r.t. quadrowidxs., i.e., quadoffsets[.][i] gives the start index of row quadrowidxs[.][i] in quadvals[.]
285 * - quadinds column indices w.r.t. quadrowidxs, i.e., quadrowidxs[quadinds[.][i]] gives the index of the variable corresponding
291 * - exprvaridxs indices of variables in expression tree, maps variable indices in expression tree to indices in nlp
313 SCIP_CALL( SCIPnlpiAddConstraints(nlpidata->nlpis[i], problem->nlpiproblems[i], ncons, lhss, rhss, nlininds,
341 * - exprvaridxs indices of variables in expression tree, maps variable indices in expression tree to indices in nlp
361 SCIP_CALL( SCIPnlpiSetObjective(nlpidata->nlpis[i], problem->nlpiproblems[i], nlins, lininds, linvals, nquadelems,
392 SCIP_CALL( SCIPnlpiChgVarBounds(nlpidata->nlpis[i], problem->nlpiproblems[i], nvars, indices, lbs, ubs) );
422 SCIP_CALL( SCIPnlpiChgConsSides(nlpidata->nlpis[i], problem->nlpiproblems[i], nconss, indices, lhss, rhss) );
461 SCIP_CALL( SCIPnlpiDelVarSet(nlpidata->nlpis[i], problem->nlpiproblems[i], tmpdstats, dstatssize) );
465 /* NOTE this works only when all dstats array are the same after calling the nlpidelvarset callback
466 * As long as all solvers use the SCIP NLPI oracle to store the NLP problem data, this is the case.
469 SCIP_CALL( SCIPnlpiDelVarSet(nlpidata->nlpis[i], problem->nlpiproblems[i], dstats, dstatssize) );
511 SCIP_CALL( SCIPnlpiDelConsSet(nlpidata->nlpis[i], problem->nlpiproblems[i], tmpdstats, dstatssize) );
515 /* NOTE this works only when all dstats array are the same after calling the nlpidelconsset callback
516 * As long as all solvers use the SCIP NLPI oracle to store the NLP problem data, this is the case.
519 SCIP_CALL( SCIPnlpiDelConsSet(nlpidata->nlpis[i], problem->nlpiproblems[i], dstats, dstatssize) );
553 SCIP_CALL( SCIPnlpiChgLinearCoefs(nlpidata->nlpis[i], problem->nlpiproblems[i], idx, nvals, varidxs, vals) );
584 SCIP_CALL( SCIPnlpiChgQuadCoefs(nlpidata->nlpis[i], problem->nlpiproblems[i], idx, nquadelems, quadelems) );
596 * - exprvaridxs indices of variables in expression tree, maps variable indices in expression tree to indices in nlp, or NULL
597 * - exprtree new expression tree for constraint or objective, or NULL to only remove previous tree
613 SCIP_CALL( SCIPnlpiChgExprtree(nlpidata->nlpis[i], problem->nlpiproblems[i], idxcons, exprvaridxs, exprtree) );
644 SCIP_CALL( SCIPnlpiChgNonlinCoef(nlpidata->nlpis[i], problem->nlpiproblems[i], idxcons, idxparam, value) );
684 * - varlbdualvalues initial dual values for variable lower bounds, or NULL to clear previous values
685 * - varubdualvalues initial dual values for variable upper bounds, or NULL to clear previous values
701 SCIP_CALL( SCIPnlpiSetInitialGuess(nlpidata->nlpis[i], problem->nlpiproblems[i], primalvalues, consdualvalues,
731 SCIP_CALL( SCIPnlpiGetRealPar(nlpidata->nlpis[0], problem->nlpiproblems[0], SCIP_NLPPAR_INFINITY, &infinity) );
767 else if( bestsolstat >= SCIP_NLPSOLSTAT_LOCINFEASIBLE && solstat <= SCIP_NLPSOLSTAT_LOCINFEASIBLE )
824 return SCIPnlpiGetSolstat(nlpidata->nlpis[problem->bestidx], problem->nlpiproblems[problem->bestidx]);
848 return SCIPnlpiGetTermstat(nlpidata->nlpis[problem->bestidx], problem->nlpiproblems[problem->bestidx]);
854 * but if solver provides dual values for one side of variable bounds, then it must also provide those for the other side
856 * for a ranged constraint, the dual variable is positive if the right hand side is active and negative if the left hand side is active
862 * - consdualvalues buffer to store pointer to array to dual values of constraints, or NULL if not needed
863 * - varlbdualvalues buffer to store pointer to array to dual values of variable lower bounds, or NULL if not needed
864 * - varubdualvalues buffer to store pointer to array to dual values of variable lower bounds, or NULL if not needed
880 SCIP_CALL( SCIPnlpiGetSolution(nlpidata->nlpis[problem->bestidx], problem->nlpiproblems[problem->bestidx],
909 SCIP_CALL( SCIPnlpiGetStatistics(nlpidata->nlpis[problem->bestidx], problem->nlpiproblems[problem->bestidx],
1026 * - problem datastructure for problem instance, can be NULL only if type == SCIP_NLPPAR_INFINITY
1053 * - problem datastructure for problem instance, can be NULL only if type == SCIP_NLPPAR_INFINITY
1219 nlpiChgObjConstantAll, nlpiSetInitialGuessAll, nlpiSolveAll, nlpiGetSolstatAll, nlpiGetTermstatAll,
1222 nlpiGetIntParAll, nlpiSetIntParAll, nlpiGetRealParAll, nlpiSetRealParAll, nlpiGetStringParAll, nlpiSetStringParAll,
SCIP_RETCODE SCIPcreateNlpSolverAll(BMS_BLKMEM *blkmem, SCIP_NLPI **nlpi, SCIP_NLPI **nlpis, int nnlpis)
Definition: nlpi_all.c:1175
SCIP_RETCODE SCIPnlpiGetRealPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, SCIP_Real *dval)
Definition: nlpi.c:654
#define BMSfreeBlockMemoryArrayNull(mem, ptr, num)
Definition: memory.h:459
SCIP_RETCODE SCIPnlpiAddVars(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nvars, const SCIP_Real *lbs, const SCIP_Real *ubs, const char **varnames)
Definition: nlpi.c:251
Definition: type_nlpi.h:64
static SCIP_DECL_NLPISETREALPAR(nlpiSetRealParAll)
Definition: nlpi_all.c:1058
static SCIP_DECL_NLPIGETWARMSTARTSIZE(nlpiGetWarmstartSizeAll)
Definition: nlpi_all.c:926
data definitions for an NLP solver interface
internal methods for NLPI solver interfaces
static SCIP_DECL_NLPICHGNONLINCOEF(nlpiChgNonlinCoefAll)
Definition: nlpi_all.c:631
SCIP_RETCODE SCIPnlpiCreateProblem(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM **problem, const char *name)
Definition: nlpi.c:212
static SCIP_DECL_NLPISETSTRINGPAR(nlpiSetStringParAll)
Definition: nlpi_all.c:1122
Definition: type_nlpi.h:82
SCIP_RETCODE SCIPnlpiChgVarBounds(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nvars, const int *indices, const SCIP_Real *lbs, const SCIP_Real *ubs)
Definition: nlpi.c:326
SCIP_RETCODE SCIPnlpiSetStringPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, const char *sval)
Definition: nlpi.c:705
static SCIP_DECL_NLPICHGEXPRTREE(nlpiChgExprtreeAll)
Definition: nlpi_all.c:600
static SCIP_DECL_NLPISETMESSAGEHDLR(nlpiSetMessageHdlrAll)
Definition: nlpi_all.c:1148
Definition: struct_message.h:36
SCIP_RETCODE SCIPnlpiDelVarSet(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int *dstats, int dstatssize)
Definition: nlpi.c:362
SCIP_RETCODE SCIPnlpiSetRealPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, SCIP_Real dval)
Definition: nlpi.c:672
Definition: type_nlpi.h:67
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)
Definition: nlpi.c:301
SCIP_RETCODE SCIPnlpiSetMessageHdlr(SCIP_NLPI *nlpi, SCIP_MESSAGEHDLR *messagehdlr)
Definition: nlpi.c:722
static SCIP_DECL_NLPIGETREALPAR(nlpiGetRealParAll)
Definition: nlpi_all.c:1034
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)
Definition: nlpi.c:269
SCIP_RETCODE SCIPnlpiGetStatistics(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPSTATISTICS *statistics)
Definition: nlpi.c:557
static SCIP_DECL_NLPIGETPROBLEMPOINTER(nlpiGetProblemPointerAll)
Definition: nlpi_all.c:222
Definition: type_nlpi.h:63
SCIP_RETCODE SCIPnlpiGetStringPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, const char **sval)
Definition: nlpi.c:688
static SCIP_DECL_NLPIGETSOLSTAT(nlpiGetSolstatAll)
Definition: nlpi_all.c:812
Definition: struct_nlpi.h:78
SCIP_RETCODE SCIPnlpiGetSolution(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_Real **primalvalues, SCIP_Real **consdualvalues, SCIP_Real **varlbdualvalues, SCIP_Real **varubdualvalues, SCIP_Real *objval)
Definition: nlpi.c:538
SCIP_NLPSOLSTAT SCIPnlpiGetSolstat(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
Definition: nlpi.c:512
static SCIP_DECL_NLPISETOBJECTIVE(nlpiSetObjectiveAll)
Definition: nlpi_all.c:348
SCIP_RETCODE SCIPnlpiDelConsSet(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int *dstats, int dstatssize)
Definition: nlpi.c:379
Definition: type_retcode.h:33
SCIP_RETCODE SCIPnlpiChgNonlinCoef(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int considx, int paramidx, SCIP_Real value)
Definition: nlpi.c:448
static SCIP_DECL_NLPIGETSOLUTION(nlpiGetSolutionAll)
Definition: nlpi_all.c:868
static SCIP_DECL_NLPICHGLINEARCOEFS(nlpiChgLinearCoefsAll)
Definition: nlpi_all.c:540
SCIP_RETCODE SCIPnlpiSetInitialGuess(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_Real *primalvalues, SCIP_Real *consdualvalues, SCIP_Real *varlbdualvalues, SCIP_Real *varubdualvalues)
Definition: nlpi.c:480
static SCIP_DECL_NLPIGETSTATISTICS(nlpiGetStatisticsAll)
Definition: nlpi_all.c:897
SCIP_RETCODE SCIPnlpiChgExprtree(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int idxcons, const int *exprvaridxs, const SCIP_EXPRTREE *exprtree)
Definition: nlpi.c:431
public data structures and miscellaneous methods
Definition: type_nlpi.h:50
int SCIPnlpStatisticsGetNIterations(SCIP_NLPSTATISTICS *statistics)
Definition: nlpi.c:818
static SCIP_DECL_NLPIDELCONSSET(nlpiDelConstraintSetAll)
Definition: nlpi_all.c:490
SCIP_RETCODE SCIPnlpiSetIntPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, int ival)
Definition: nlpi.c:637
static SCIP_DECL_NLPIGETSTRINGPAR(nlpiGetStringParAll)
Definition: nlpi_all.c:1098
static SCIP_DECL_NLPICHGOBJCONSTANT(nlpiChgObjConstantAll)
Definition: nlpi_all.c:658
static SCIP_DECL_NLPIADDCONSTRAINTS(nlpiAddConstraintsAll)
Definition: nlpi_all.c:300
static SCIP_DECL_NLPICHGQUADCOEFS(nlpiChgQuadraticCoefsAll)
Definition: nlpi_all.c:571
SCIP_RETCODE SCIPnlpiSolve(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
Definition: nlpi.c:498
static SCIP_DECL_NLPIGETSOLVERPOINTER(nlpiGetSolverPointerAll)
Definition: nlpi_all.c:138
ALL NLP interface.
static SCIP_DECL_NLPIGETTERMSTAT(nlpiGetTermstatAll)
Definition: nlpi_all.c:836
SCIP_RETCODE SCIPnlpiChgLinearCoefs(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, const int idx, int nvals, const int *varidxs, const SCIP_Real *vals)
Definition: nlpi.c:396
static SCIP_DECL_NLPICREATEPROBLEM(nlpiCreateProblemAll)
Definition: nlpi_all.c:153
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)
Definition: nlpi.c:41
static SCIP_DECL_NLPISETINITIALGUESS(nlpiSetInitialGuessAll)
Definition: nlpi_all.c:688
SCIP_Real SCIPnlpStatisticsGetTotalTime(SCIP_NLPSTATISTICS *statistics)
Definition: nlpi.c:828
static SCIP_DECL_NLPISETWARMSTARTMEMO(nlpiSetWarmstartMemoAll)
Definition: nlpi_all.c:961
SCIP_RETCODE SCIPnlpiChgConsSides(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nconss, const int *indices, const SCIP_Real *lhss, const SCIP_Real *rhss)
Definition: nlpi.c:344
SCIP_RETCODE SCIPnlpiChgObjConstant(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_Real objconstant)
Definition: nlpi.c:465
static SCIP_DECL_NLPIGETWARMSTARTMEMO(nlpiGetWarmstartMemoAll)
Definition: nlpi_all.c:945
SCIP_RETCODE SCIPnlpiFreeProblem(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM **problem)
Definition: nlpi.c:225
public methods for message output
static SCIP_DECL_NLPICHGVARBOUNDS(nlpiChgVarBoundsAll)
Definition: nlpi_all.c:379
SCIP_NLPTERMSTAT SCIPnlpiGetTermstat(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
Definition: nlpi.c:524
static SCIP_DECL_NLPIFREEPROBLEM(nlpiFreeProblemAll)
Definition: nlpi_all.c:187
static SCIP_DECL_NLPICHGCONSSIDES(nlpiChgConsSidesAll)
Definition: nlpi_all.c:409
SCIP_RETCODE SCIPnlpiChgQuadCoefs(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int idx, int nquadelems, const SCIP_QUADELEM *quadelems)
Definition: nlpi.c:414
Definition: nlpi_all.c:50
SCIP_RETCODE SCIPnlpiCopy(BMS_BLKMEM *blkmem, SCIP_NLPI *sourcenlpi, SCIP_NLPI **targetnlpi)
Definition: nlpi.c:166
SCIP_RETCODE SCIPnlpiGetIntPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, int *ival)
Definition: nlpi.c:620
Definition: struct_nlpi.h:35