nlpi_all.c
Go to the documentation of this file.
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32 #define NLPI_DESC "NLP interface that uses all available NLP interfaces" /* description of solver */
253 SCIP_CALL( SCIPnlpiAddVars(nlpidata->nlpis[i], problem->nlpiproblems[i], nvars, lbs, ubs, varnames) );
280 * indices are given w.r.t. quadrowidxs., i.e., quadoffsets[.][i] gives the start index of row quadrowidxs[.][i] in quadvals[.]
284 * - quadinds column indices w.r.t. quadrowidxs, i.e., quadrowidxs[quadinds[.][i]] gives the index of the variable corresponding
290 * - exprvaridxs indices of variables in expression tree, maps variable indices in expression tree to indices in nlp
312 SCIP_CALL( SCIPnlpiAddConstraints(nlpidata->nlpis[i], problem->nlpiproblems[i], ncons, lhss, rhss, nlininds,
340 * - exprvaridxs indices of variables in expression tree, maps variable indices in expression tree to indices in nlp
360 SCIP_CALL( SCIPnlpiSetObjective(nlpidata->nlpis[i], problem->nlpiproblems[i], nlins, lininds, linvals, nquadelems,
391 SCIP_CALL( SCIPnlpiChgVarBounds(nlpidata->nlpis[i], problem->nlpiproblems[i], nvars, indices, lbs, ubs) );
421 SCIP_CALL( SCIPnlpiChgConsSides(nlpidata->nlpis[i], problem->nlpiproblems[i], nconss, indices, lhss, rhss) );
460 SCIP_CALL( SCIPnlpiDelVarSet(nlpidata->nlpis[i], problem->nlpiproblems[i], tmpdstats, dstatssize) );
464 /* NOTE this works only when all dstats array are the same after calling the nlpidelvarset callback
465 * As long as all solvers use the SCIP NLPI oracle to store the NLP problem data, this is the case.
468 SCIP_CALL( SCIPnlpiDelVarSet(nlpidata->nlpis[i], problem->nlpiproblems[i], dstats, dstatssize) );
510 SCIP_CALL( SCIPnlpiDelConsSet(nlpidata->nlpis[i], problem->nlpiproblems[i], tmpdstats, dstatssize) );
514 /* NOTE this works only when all dstats array are the same after calling the nlpidelconsset callback
515 * As long as all solvers use the SCIP NLPI oracle to store the NLP problem data, this is the case.
518 SCIP_CALL( SCIPnlpiDelConsSet(nlpidata->nlpis[i], problem->nlpiproblems[i], dstats, dstatssize) );
552 SCIP_CALL( SCIPnlpiChgLinearCoefs(nlpidata->nlpis[i], problem->nlpiproblems[i], idx, nvals, varidxs, vals) );
583 SCIP_CALL( SCIPnlpiChgQuadCoefs(nlpidata->nlpis[i], problem->nlpiproblems[i], idx, nquadelems, quadelems) );
595 * - exprvaridxs indices of variables in expression tree, maps variable indices in expression tree to indices in nlp, or NULL
596 * - exprtree new expression tree for constraint or objective, or NULL to only remove previous tree
612 SCIP_CALL( SCIPnlpiChgExprtree(nlpidata->nlpis[i], problem->nlpiproblems[i], idxcons, exprvaridxs, exprtree) );
643 SCIP_CALL( SCIPnlpiChgNonlinCoef(nlpidata->nlpis[i], problem->nlpiproblems[i], idxcons, idxparam, value) );
683 * - varlbdualvalues initial dual values for variable lower bounds, or NULL to clear previous values
684 * - varubdualvalues initial dual values for variable upper bounds, or NULL to clear previous values
700 SCIP_CALL( SCIPnlpiSetInitialGuess(nlpidata->nlpis[i], problem->nlpiproblems[i], primalvalues, consdualvalues,
730 SCIP_CALL( SCIPnlpiGetRealPar(nlpidata->nlpis[0], problem->nlpiproblems[0], SCIP_NLPPAR_INFINITY, &infinity) );
766 else if( bestsolstat >= SCIP_NLPSOLSTAT_LOCINFEASIBLE && solstat <= SCIP_NLPSOLSTAT_LOCINFEASIBLE )
823 return SCIPnlpiGetSolstat(nlpidata->nlpis[problem->bestidx], problem->nlpiproblems[problem->bestidx]);
847 return SCIPnlpiGetTermstat(nlpidata->nlpis[problem->bestidx], problem->nlpiproblems[problem->bestidx]);
853 * but if solver provides dual values for one side of variable bounds, then it must also provide those for the other side
855 * 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
861 * - consdualvalues buffer to store pointer to array to dual values of constraints, or NULL if not needed
862 * - varlbdualvalues buffer to store pointer to array to dual values of variable lower bounds, or NULL if not needed
863 * - varubdualvalues buffer to store pointer to array to dual values of variable lower bounds, or NULL if not needed
879 SCIP_CALL( SCIPnlpiGetSolution(nlpidata->nlpis[problem->bestidx], problem->nlpiproblems[problem->bestidx],
908 SCIP_CALL( SCIPnlpiGetStatistics(nlpidata->nlpis[problem->bestidx], problem->nlpiproblems[problem->bestidx],
1025 * - problem datastructure for problem instance, can be NULL only if type == SCIP_NLPPAR_INFINITY
1052 * - problem datastructure for problem instance, can be NULL only if type == SCIP_NLPPAR_INFINITY
1218 nlpiChgObjConstantAll, nlpiSetInitialGuessAll, nlpiSolveAll, nlpiGetSolstatAll, nlpiGetTermstatAll,
1221 nlpiGetIntParAll, nlpiSetIntParAll, nlpiGetRealParAll, nlpiSetRealParAll, nlpiGetStringParAll, nlpiSetStringParAll,
#define BMSfreeBlockMemoryArrayNull(mem, ptr, num)
Definition: memory.h:449
SCIP_RETCODE SCIPnlpiGetStatistics(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPSTATISTICS *statistics)
Definition: nlpi.c:556
Definition: type_nlpi.h:64
static SCIP_DECL_NLPISETREALPAR(nlpiSetRealParAll)
Definition: nlpi_all.c:1057
static SCIP_DECL_NLPIGETWARMSTARTSIZE(nlpiGetWarmstartSizeAll)
Definition: nlpi_all.c:925
SCIP_Real SCIPnlpStatisticsGetTotalTime(SCIP_NLPSTATISTICS *statistics)
Definition: nlpi.c:826
internal methods for NLPI solver interfaces
SCIP_RETCODE SCIPnlpiSetStringPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, const char *sval)
Definition: nlpi.c:704
static SCIP_DECL_NLPICHGNONLINCOEF(nlpiChgNonlinCoefAll)
Definition: nlpi_all.c:630
SCIP_RETCODE SCIPnlpiCreateProblem(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM **problem, const char *name)
Definition: nlpi.c:211
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:537
SCIP_RETCODE SCIPnlpiDelVarSet(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int *dstats, int dstatssize)
Definition: nlpi.c:361
static SCIP_DECL_NLPISETSTRINGPAR(nlpiSetStringParAll)
Definition: nlpi_all.c:1121
Definition: type_nlpi.h:82
static SCIP_DECL_NLPICHGEXPRTREE(nlpiChgExprtreeAll)
Definition: nlpi_all.c:599
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:268
static SCIP_DECL_NLPISETMESSAGEHDLR(nlpiSetMessageHdlrAll)
Definition: nlpi_all.c:1147
Definition: struct_message.h:36
SCIP_RETCODE SCIPnlpiSetMessageHdlr(SCIP_NLPI *nlpi, SCIP_MESSAGEHDLR *messagehdlr)
Definition: nlpi.c:720
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:325
Definition: type_nlpi.h:67
SCIP_RETCODE SCIPnlpiSolve(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
Definition: nlpi.c:497
SCIP_RETCODE SCIPnlpiGetStringPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, const char **sval)
Definition: nlpi.c:687
static SCIP_DECL_NLPIGETREALPAR(nlpiGetRealParAll)
Definition: nlpi_all.c:1033
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:250
static SCIP_DECL_NLPIGETPROBLEMPOINTER(nlpiGetProblemPointerAll)
Definition: nlpi_all.c:221
Definition: type_nlpi.h:63
static SCIP_DECL_NLPIGETSOLSTAT(nlpiGetSolstatAll)
Definition: nlpi_all.c:811
Definition: struct_nlpi.h:78
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:343
static SCIP_DECL_NLPISETOBJECTIVE(nlpiSetObjectiveAll)
Definition: nlpi_all.c:347
Definition: type_retcode.h:33
SCIP_RETCODE SCIPnlpiSetInitialGuess(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_Real *primalvalues, SCIP_Real *consdualvalues, SCIP_Real *varlbdualvalues, SCIP_Real *varubdualvalues)
Definition: nlpi.c:479
static SCIP_DECL_NLPIGETSOLUTION(nlpiGetSolutionAll)
Definition: nlpi_all.c:867
static SCIP_DECL_NLPICHGLINEARCOEFS(nlpiChgLinearCoefsAll)
Definition: nlpi_all.c:539
SCIP_NLPSOLSTAT SCIPnlpiGetSolstat(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
Definition: nlpi.c:511
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:300
static SCIP_DECL_NLPIGETSTATISTICS(nlpiGetStatisticsAll)
Definition: nlpi_all.c:896
SCIP_RETCODE SCIPnlpiDelConsSet(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int *dstats, int dstatssize)
Definition: nlpi.c:378
SCIP_RETCODE SCIPnlpiFreeProblem(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM **problem)
Definition: nlpi.c:224
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:40
public data structures and miscellaneous methods
SCIP_RETCODE SCIPnlpiCopy(BMS_BLKMEM *blkmem, SCIP_NLPI *sourcenlpi, SCIP_NLPI **targetnlpi)
Definition: nlpi.c:165
Definition: type_nlpi.h:50
static SCIP_DECL_NLPIDELCONSSET(nlpiDelConstraintSetAll)
Definition: nlpi_all.c:489
SCIP_RETCODE SCIPnlpiSetIntPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, int ival)
Definition: nlpi.c:636
SCIP_NLPTERMSTAT SCIPnlpiGetTermstat(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
Definition: nlpi.c:523
static SCIP_DECL_NLPIGETSTRINGPAR(nlpiGetStringParAll)
Definition: nlpi_all.c:1097
static SCIP_DECL_NLPICHGOBJCONSTANT(nlpiChgObjConstantAll)
Definition: nlpi_all.c:657
SCIP_RETCODE SCIPnlpiChgNonlinCoef(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int considx, int paramidx, SCIP_Real value)
Definition: nlpi.c:447
SCIP_RETCODE SCIPnlpiChgQuadCoefs(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int idx, int nquadelems, const SCIP_QUADELEM *quadelems)
Definition: nlpi.c:413
static SCIP_DECL_NLPIADDCONSTRAINTS(nlpiAddConstraintsAll)
Definition: nlpi_all.c:299
static SCIP_DECL_NLPICHGQUADCOEFS(nlpiChgQuadraticCoefsAll)
Definition: nlpi_all.c:570
static SCIP_DECL_NLPIGETSOLVERPOINTER(nlpiGetSolverPointerAll)
Definition: nlpi_all.c:135
ALL NLP interface.
static SCIP_DECL_NLPIGETTERMSTAT(nlpiGetTermstatAll)
Definition: nlpi_all.c:835
static SCIP_DECL_NLPICREATEPROBLEM(nlpiCreateProblemAll)
Definition: nlpi_all.c:150
static SCIP_DECL_NLPISETINITIALGUESS(nlpiSetInitialGuessAll)
Definition: nlpi_all.c:687
static SCIP_DECL_NLPISETWARMSTARTMEMO(nlpiSetWarmstartMemoAll)
Definition: nlpi_all.c:960
static SCIP_DECL_NLPIGETWARMSTARTMEMO(nlpiGetWarmstartMemoAll)
Definition: nlpi_all.c:944
public methods for message output
static SCIP_DECL_NLPICHGVARBOUNDS(nlpiChgVarBoundsAll)
Definition: nlpi_all.c:378
int SCIPnlpStatisticsGetNIterations(SCIP_NLPSTATISTICS *statistics)
Definition: nlpi.c:816
SCIP_RETCODE SCIPnlpiChgLinearCoefs(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, const int idx, int nvals, const int *varidxs, const SCIP_Real *vals)
Definition: nlpi.c:395
SCIP_RETCODE SCIPcreateNlpSolverAll(BMS_BLKMEM *blkmem, SCIP_NLPI **nlpi, SCIP_NLPI **nlpis, int nnlpis)
Definition: nlpi_all.c:1174
SCIP_RETCODE SCIPnlpiChgExprtree(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int idxcons, const int *exprvaridxs, const SCIP_EXPRTREE *exprtree)
Definition: nlpi.c:430
static SCIP_DECL_NLPIFREEPROBLEM(nlpiFreeProblemAll)
Definition: nlpi_all.c:186
SCIP_RETCODE SCIPnlpiGetIntPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, int *ival)
Definition: nlpi.c:619
Definition: type_retcode.h:35
static SCIP_DECL_NLPICHGCONSSIDES(nlpiChgConsSidesAll)
Definition: nlpi_all.c:408
SCIP_RETCODE SCIPnlpiGetRealPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, SCIP_Real *dval)
Definition: nlpi.c:653
SCIP_RETCODE SCIPnlpiChgObjConstant(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_Real objconstant)
Definition: nlpi.c:464
Definition: nlpi_all.c:47
SCIP_RETCODE SCIPnlpiSetRealPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, SCIP_Real dval)
Definition: nlpi.c:671
Definition: struct_nlpi.h:35