Detailed Description
NLP interface that uses all available NLP interfaces.
Definition in file nlpi_all.c.
#include "nlpi/nlpi_all.h"
#include "nlpi/nlpi.h"
#include "scip/pub_misc.h"
#include "scip/pub_message.h"
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | SCIP_NlpiProblem |
Macros | |
#define | NLPI_NAME "all" /* short concise name of solver */ |
#define | NLPI_DESC "NLP interface that uses all available NLP interfaces" /* description of solver */ |
#define | NLPI_PRIORITY -3000 /* priority of NLP solver */ |
Functions | |
static | SCIP_DECL_NLPICOPY (nlpiCopyAll) |
static | SCIP_DECL_NLPIFREE (nlpiFreeAll) |
static | SCIP_DECL_NLPIGETSOLVERPOINTER (nlpiGetSolverPointerAll) |
static | SCIP_DECL_NLPICREATEPROBLEM (nlpiCreateProblemAll) |
static | SCIP_DECL_NLPIFREEPROBLEM (nlpiFreeProblemAll) |
static | SCIP_DECL_NLPIGETPROBLEMPOINTER (nlpiGetProblemPointerAll) |
static | SCIP_DECL_NLPIADDVARS (nlpiAddVarsAll) |
static | SCIP_DECL_NLPIADDCONSTRAINTS (nlpiAddConstraintsAll) |
static | SCIP_DECL_NLPISETOBJECTIVE (nlpiSetObjectiveAll) |
static | SCIP_DECL_NLPICHGVARBOUNDS (nlpiChgVarBoundsAll) |
static | SCIP_DECL_NLPICHGCONSSIDES (nlpiChgConsSidesAll) |
static | SCIP_DECL_NLPIDELVARSET (nlpiDelVarSetAll) |
static | SCIP_DECL_NLPIDELCONSSET (nlpiDelConstraintSetAll) |
static | SCIP_DECL_NLPICHGLINEARCOEFS (nlpiChgLinearCoefsAll) |
static | SCIP_DECL_NLPICHGQUADCOEFS (nlpiChgQuadraticCoefsAll) |
static | SCIP_DECL_NLPICHGEXPRTREE (nlpiChgExprtreeAll) |
static | SCIP_DECL_NLPICHGNONLINCOEF (nlpiChgNonlinCoefAll) |
static | SCIP_DECL_NLPICHGOBJCONSTANT (nlpiChgObjConstantAll) |
static | SCIP_DECL_NLPISETINITIALGUESS (nlpiSetInitialGuessAll) |
static | SCIP_DECL_NLPISOLVE (nlpiSolveAll) |
static | SCIP_DECL_NLPIGETSOLSTAT (nlpiGetSolstatAll) |
static | SCIP_DECL_NLPIGETTERMSTAT (nlpiGetTermstatAll) |
static | SCIP_DECL_NLPIGETSOLUTION (nlpiGetSolutionAll) |
static | SCIP_DECL_NLPIGETSTATISTICS (nlpiGetStatisticsAll) |
static | SCIP_DECL_NLPIGETWARMSTARTSIZE (nlpiGetWarmstartSizeAll) |
static | SCIP_DECL_NLPIGETWARMSTARTMEMO (nlpiGetWarmstartMemoAll) |
static | SCIP_DECL_NLPISETWARMSTARTMEMO (nlpiSetWarmstartMemoAll) |
static | SCIP_DECL_NLPIGETINTPAR (nlpiGetIntParAll) |
static | SCIP_DECL_NLPISETINTPAR (nlpiSetIntParAll) |
static | SCIP_DECL_NLPIGETREALPAR (nlpiGetRealParAll) |
static | SCIP_DECL_NLPISETREALPAR (nlpiSetRealParAll) |
static | SCIP_DECL_NLPIGETSTRINGPAR (nlpiGetStringParAll) |
static | SCIP_DECL_NLPISETSTRINGPAR (nlpiSetStringParAll) |
static | SCIP_DECL_NLPISETMESSAGEHDLR (nlpiSetMessageHdlrAll) |
SCIP_RETCODE | SCIPcreateNlpSolverAll (BMS_BLKMEM *blkmem, SCIP_NLPI **nlpi, SCIP_NLPI **nlpis, int nnlpis) |
Macro Definition Documentation
◆ NLPI_NAME
#define NLPI_NAME "all" /* short concise name of solver */ |
Definition at line 31 of file nlpi_all.c.
Referenced by SCIPcreateNlpSolverAll().
◆ NLPI_DESC
#define NLPI_DESC "NLP interface that uses all available NLP interfaces" /* description of solver */ |
Definition at line 32 of file nlpi_all.c.
Referenced by SCIPcreateNlpSolverAll().
◆ NLPI_PRIORITY
#define NLPI_PRIORITY -3000 /* priority of NLP solver */ |
Definition at line 33 of file nlpi_all.c.
Referenced by SCIPcreateNlpSolverAll().
Function Documentation
◆ SCIP_DECL_NLPICOPY()
|
static |
copy method of NLP interface (called when SCIP copies plugins)
input:
- blkmem block memory in target SCIP
- sourcenlpi the NLP interface to copy
- targetnlpi buffer to store pointer to copy of NLP interface
Definition at line 74 of file nlpi_all.c.
References infinity, NULL, SCIP_CALL, SCIP_NLPPAR_INFINITY, SCIP_OKAY, SCIP_Real, SCIPcreateNlpSolverAll(), SCIPnlpiGetData(), SCIPnlpiGetRealPar(), SCIPnlpiSetMessageHdlr(), and SCIPnlpiSetRealPar().
◆ SCIP_DECL_NLPIFREE()
|
static |
destructor of NLP interface to free nlpi data
input:
- nlpi datastructure for solver interface
Definition at line 104 of file nlpi_all.c.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArrayNull, NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiFree(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPIGETSOLVERPOINTER()
|
static |
gets pointer for NLP solver
to do dirty stuff
input:
- nlpi datastructure for solver interface
return: void pointer to solver
Definition at line 135 of file nlpi_all.c.
References NULL.
◆ SCIP_DECL_NLPICREATEPROBLEM()
|
static |
creates a problem instance
input:
- nlpi datastructure for solver interface
- problem pointer to store the problem data
- name name of problem, can be NULL
Definition at line 150 of file nlpi_all.c.
References BMSallocBlockMemory, BMSallocBlockMemoryArray, BMSclearMemory, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_NOMEMORY, SCIP_OKAY, SCIPnlpiCreateProblem(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPIFREEPROBLEM()
|
static |
free a problem instance
input:
- nlpi datastructure for solver interface
- problem pointer where problem data is stored
Definition at line 186 of file nlpi_all.c.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArrayNull, NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiFreeProblem(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPIGETPROBLEMPOINTER()
|
static |
gets pointer to solver-internal problem instance
to do dirty stuff
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
return: void pointer to problem instance
Definition at line 221 of file nlpi_all.c.
References NULL.
◆ SCIP_DECL_NLPIADDVARS()
|
static |
add variables
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- nvars number of variables
- lbs lower bounds of variables, can be NULL if -infinity
- ubs upper bounds of variables, can be NULL if +infinity
- varnames names of variables, can be NULL
Definition at line 240 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiAddVars(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPIADDCONSTRAINTS()
|
static |
add constraints quadratic coefficiens: row oriented matrix for each constraint
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- ncons number of added constraints
- lhss left hand sides of constraints
- rhss right hand sides of constraints
- nlininds number of linear coefficients for each constraint may be NULL in case of no linear part
- lininds indices of variables for linear coefficients for each constraint may be NULL in case of no linear part
- linvals values of linear coefficient for each constraint may be NULL in case of no linear part
- nquadrows number of columns in matrix of quadratic part for each constraint may be NULL in case of no quadratic part in any constraint
- quadrowidxs indices of variables for which a quadratic part is specified may be NULL in case of no quadratic part in any constraint
- quadoffsets start index of each rows quadratic coefficients in quadinds[.] and quadvals[.] indices are given w.r.t. quadrowidxs., i.e., quadoffsets[.][i] gives the start index of row quadrowidxs[.][i] in quadvals[.] quadoffsets[.][nquadrows[.]] gives length of quadinds[.] and quadvals[.] entry of array may be NULL in case of no quadratic part may be NULL in case of no quadratic part in any constraint
- quadinds column indices w.r.t. quadrowidxs, i.e., quadrowidxs[quadinds[.][i]] gives the index of the variable corresponding to entry i, entry of array may be NULL in case of no quadratic part may be NULL in case of no quadratic part in any constraint
- quadvals coefficient values entry of array may be NULL in case of no quadratic part may be NULL in case of no quadratic part in any constraint
- exprvaridxs indices of variables in expression tree, maps variable indices in expression tree to indices in nlp entry of array may be NULL in case of no expression tree may be NULL in case of no expression tree in any constraint
- exprtrees expression tree for nonquadratic part of constraints entry of array may be NULL in case of no nonquadratic part may be NULL in case of no nonquadratic part in any constraint
- names of constraints, may be NULL or entries may be NULL
Definition at line 299 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiAddConstraints(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPISETOBJECTIVE()
|
static |
sets or overwrites objective, a minimization problem is expected May change sparsity pattern.
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- nlins number of linear variables
- lininds variable indices may be NULL in case of no linear part
- linvals coefficient values may be NULL in case of no linear part
- nquadcols number of columns in matrix of quadratic part
- quadcols indices of variables for which a quadratic part is specified may be NULL in case of no quadratic part
- quadoffsets start index of each rows quadratic coefficients in quadinds and quadvals quadoffsets[.][nquadcols] gives length of quadinds and quadvals may be NULL in case of no quadratic part
- quadinds column indices may be NULL in case of no quadratic part
- quadvals coefficient values may be NULL in case of no quadratic part
- exprvaridxs indices of variables in expression tree, maps variable indices in expression tree to indices in nlp may be NULL in case of no expression tree
- exprtree expression tree for nonquadratic part of objective function may be NULL in case of no nonquadratic part
- constant objective value offset
Definition at line 347 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiGetData(), and SCIPnlpiSetObjective().
◆ SCIP_DECL_NLPICHGVARBOUNDS()
|
static |
change variable bounds
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- nvars number of variables to change bounds
- indices indices of variables to change bounds
- lbs new lower bounds
- ubs new upper bounds
Definition at line 378 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiChgVarBounds(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPICHGCONSSIDES()
|
static |
change constraint bounds
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- nconss number of constraints to change sides
- indices indices of constraints to change sides
- lhss new left hand sides
- rhss new right hand sides
Definition at line 408 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiChgConsSides(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPIDELVARSET()
|
static |
delete a set of variables
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- dstats deletion status of vars; 1 if var should be deleted, 0 if not
- size of the dstats array
output:
- dstats new position of var, -1 if var was deleted
Definition at line 439 of file nlpi_all.c.
References BMSallocBlockMemoryArray, BMScopyMemoryArray, BMSfreeBlockMemoryArray, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPnlpiDelVarSet(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPIDELCONSSET()
|
static |
delete a set of constraints
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- dstats deletion status of rows; 1 if row should be deleted, 0 if not
- size of the dstats array
output:
- dstats new position of row, -1 if row was deleted
Definition at line 489 of file nlpi_all.c.
References BMSallocBlockMemoryArray, BMScopyMemoryArray, BMSfreeBlockMemoryArray, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPnlpiDelConsSet(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPICHGLINEARCOEFS()
|
static |
changes (or adds) linear coefficients in a constraint or objective
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- idx index of constraint or -1 for objective
- nvals number of values in linear constraint to change
- varidxs indices of variables which coefficient to change
- vals new values for coefficients
Definition at line 539 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiChgLinearCoefs(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPICHGQUADCOEFS()
|
static |
changes (or adds) coefficients in the quadratic part of a constraint or objective
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- idx index of constraint or -1 for objective
- nentries number of entries in quadratic matrix to change
- rows row indices of entries in quadratic matrix where values should be changed
- cols column indices of entries in quadratic matrix where values should be changed
- values new values for entries in quadratic matrix
Definition at line 570 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiChgQuadCoefs(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPICHGEXPRTREE()
|
static |
replaces the expression tree of a constraint or objective
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- idxcons index of constraint or -1 for objective
- exprvaridxs indices of variables in expression tree, maps variable indices in expression tree to indices in nlp, or NULL
- exprtree new expression tree for constraint or objective, or NULL to only remove previous tree
Definition at line 599 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiChgExprtree(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPICHGNONLINCOEF()
|
static |
change one coefficient in the nonlinear part
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- idxcons index of constraint or -1 for objective
- idxparam index of parameter
- value new value for nonlinear parameter
return: Error if parameter does not exist
Definition at line 630 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiChgNonlinCoef(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPICHGOBJCONSTANT()
|
static |
change the constant offset in the objective
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- objconstant new value for objective constant
Definition at line 657 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiChgObjConstant(), and SCIPnlpiGetData().
◆ SCIP_DECL_NLPISETINITIALGUESS()
|
static |
sets initial guess for primal variables
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- primalvalues initial primal values for variables, or NULL to clear previous values
- consdualvalues initial dual values for constraints, or NULL to clear previous values
- varlbdualvalues initial dual values for variable lower bounds, or NULL to clear previous values
- varubdualvalues initial dual values for variable upper bounds, or NULL to clear previous values
Definition at line 687 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiGetData(), and SCIPnlpiSetInitialGuess().
◆ SCIP_DECL_NLPISOLVE()
|
static |
tries to solve NLP
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
Definition at line 714 of file nlpi_all.c.
References FALSE, infinity, NULL, SCIP_Bool, SCIP_CALL, SCIP_NLPPAR_INFINITY, SCIP_NLPSOLSTAT_FEASIBLE, SCIP_NLPSOLSTAT_LOCINFEASIBLE, SCIP_NLPSOLSTAT_UNKNOWN, SCIP_NLPTERMSTAT_OTHER, SCIP_OKAY, SCIP_Real, SCIPnlpiGetData(), SCIPnlpiGetName(), SCIPnlpiGetRealPar(), SCIPnlpiGetSolstat(), SCIPnlpiGetSolution(), SCIPnlpiGetStatistics(), SCIPnlpiGetTermstat(), SCIPnlpiSolve(), SCIPnlpStatisticsGetNIterations(), SCIPnlpStatisticsGetTotalTime(), SCIPstatisticMessage, and TRUE.
◆ SCIP_DECL_NLPIGETSOLSTAT()
|
static |
gives solution status
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
return: Solution Status
Definition at line 811 of file nlpi_all.c.
References NULL, SCIPnlpiGetData(), and SCIPnlpiGetSolstat().
◆ SCIP_DECL_NLPIGETTERMSTAT()
|
static |
gives termination reason
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
return: Termination Status
Definition at line 835 of file nlpi_all.c.
References NULL, SCIPnlpiGetData(), and SCIPnlpiGetTermstat().
◆ SCIP_DECL_NLPIGETSOLUTION()
|
static |
gives primal and dual solution values
solver can return NULL in dual values if not available but if solver provides dual values for one side of variable bounds, then it must also provide those for the other side
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
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- primalvalues buffer to store pointer to array to primal values, or NULL if not needed
- consdualvalues buffer to store pointer to array to dual values of constraints, or NULL if not needed
- varlbdualvalues buffer to store pointer to array to dual values of variable lower bounds, or NULL if not needed
- varubdualvalues buffer to store pointer to array to dual values of variable lower bounds, or NULL if not needed
- objval pointer store the objective value, or NULL if not needed
Definition at line 867 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiGetData(), and SCIPnlpiGetSolution().
◆ SCIP_DECL_NLPIGETSTATISTICS()
|
static |
gives solve statistics
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- statistics pointer to store statistics
output:
- statistics solve statistics
Definition at line 896 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiGetData(), and SCIPnlpiGetStatistics().
◆ SCIP_DECL_NLPIGETWARMSTARTSIZE()
|
static |
gives required size of a buffer to store a warmstart object
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- size pointer to store required size for warmstart buffer
output:
- size required size for warmstart buffer
Definition at line 925 of file nlpi_all.c.
References SCIP_OKAY, and SCIPerrorMessage.
◆ SCIP_DECL_NLPIGETWARMSTARTMEMO()
|
static |
stores warmstart information in buffer
required size of buffer should have been obtained by SCIPnlpiGetWarmstartSize before
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- buffer memory to store warmstart information
output:
- buffer warmstart information in solver specific data structure
Definition at line 944 of file nlpi_all.c.
References SCIP_OKAY, and SCIPerrorMessage.
◆ SCIP_DECL_NLPISETWARMSTARTMEMO()
|
static |
sets warmstart information in solver
write warmstart to buffer
input:
- nlpi datastructure for solver interface
- problem datastructure for problem instance
- buffer warmstart information
Definition at line 960 of file nlpi_all.c.
References SCIP_OKAY, and SCIPerrorMessage.
◆ SCIP_DECL_NLPIGETINTPAR()
|
static |
gets integer parameter of NLP
input:
- nlpi NLP interface structure
- problem datastructure for problem instance
- type parameter number
- ival pointer to store the parameter value
output:
- ival parameter value
Definition at line 978 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiGetData(), and SCIPnlpiGetIntPar().
◆ SCIP_DECL_NLPISETINTPAR()
|
static |
sets integer parameter of NLP
input:
- nlpi NLP interface structure
- problem datastructure for problem instance
- type parameter number
- ival parameter value
Definition at line 1002 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiGetData(), and SCIPnlpiSetIntPar().
◆ SCIP_DECL_NLPIGETREALPAR()
|
static |
gets floating point parameter of NLP
input:
- nlpi NLP interface structure
- problem datastructure for problem instance, can be NULL only if type == SCIP_NLPPAR_INFINITY
- type parameter number
- dval pointer to store the parameter value
output:
- dval parameter value
Definition at line 1033 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiGetData(), and SCIPnlpiGetRealPar().
◆ SCIP_DECL_NLPISETREALPAR()
|
static |
sets floating point parameter of NLP
input:
- nlpi NLP interface structure
- problem datastructure for problem instance, can be NULL only if type == SCIP_NLPPAR_INFINITY
- type parameter number
- dval parameter value
Definition at line 1057 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_NLPPAR_INFINITY, SCIP_OKAY, SCIPnlpiGetData(), and SCIPnlpiSetRealPar().
◆ SCIP_DECL_NLPIGETSTRINGPAR()
|
static |
gets string parameter of NLP
input:
- nlpi NLP interface structure
- problem datastructure for problem instance
- type parameter number
- sval pointer to store the string value, the user must not modify the string
output:
- sval parameter value
Definition at line 1097 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiGetData(), and SCIPnlpiGetStringPar().
◆ SCIP_DECL_NLPISETSTRINGPAR()
|
static |
sets string parameter of NLP
input:
- nlpi NLP interface structure
- problem datastructure for problem instance
- type parameter number
- sval parameter value
Definition at line 1121 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiGetData(), and SCIPnlpiSetStringPar().
◆ SCIP_DECL_NLPISETMESSAGEHDLR()
|
static |
sets message handler for message output
input:
- nlpi NLP interface structure
- messagehdlr SCIP message handler, or NULL to suppress all output
Definition at line 1147 of file nlpi_all.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiGetData(), and SCIPnlpiSetMessageHdlr().