Detailed Description
methods for handling NLP solver interface
Definition in file nlpi.c.
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include "scip/nlpi.h"
#include "scip/pub_message.h"
#include "scip/pub_nlpi.h"
#include "scip/clock.h"
#include "scip/struct_nlpi.h"
#include "scip/struct_set.h"
#include "scip/struct_stat.h"
Go to the source code of this file.
Function Documentation
◆ SCIPnlpiCreate()
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_NLPICHGEXPR((*nlpichgexpr)) | , | ||
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_NLPIDATA * | nlpidata | ||
) |
creates an NLP solver interface
- Parameters
-
nlpi pointer to NLP interface data structure name name of NLP interface description description of NLP interface priority priority of NLP interface nlpidata NLP interface local data
Definition at line 53 of file nlpi.c.
References BMSallocClearMemory, BMSduplicateMemoryArray, BMSfreeMemory, BMSfreeMemoryArray, NULL, SCIP_ALLOC, SCIP_CLOCKTYPE_DEFAULT, SCIP_NOMEMORY, SCIP_OKAY, and SCIPclockCreate().
Referenced by SCIPincludeNlpi().
◆ SCIPnlpiSetPriority()
void SCIPnlpiSetPriority | ( | SCIP_NLPI * | nlpi, |
int | priority | ||
) |
sets NLP solver priority
- Parameters
-
nlpi NLP interface structure priority new priority of NLPI
Definition at line 156 of file nlpi.c.
References NULL, and SCIP_Nlpi::priority.
◆ SCIPnlpiCopyInclude()
SCIP_RETCODE SCIPnlpiCopyInclude | ( | SCIP_NLPI * | sourcenlpi, |
SCIP_SET * | targetset | ||
) |
copies an NLPI and includes it into another SCIP instance
- Parameters
-
sourcenlpi the NLP interface to copy targetset global SCIP settings where to include copy
Definition at line 167 of file nlpi.c.
References NULL, SCIP_Set::scip, SCIP_CALL, and SCIP_OKAY.
Referenced by SCIPsetCopyPlugins().
◆ SCIPnlpiFree()
SCIP_RETCODE SCIPnlpiFree | ( | SCIP_NLPI ** | nlpi, |
SCIP_SET * | set | ||
) |
frees NLPI
- Parameters
-
nlpi pointer to NLPI data structure set global SCIP settings
Definition at line 184 of file nlpi.c.
References BMSfreeMemory, BMSfreeMemoryArray, SCIP_Nlpi::nlpidata, NULL, SCIP_CALL, SCIP_OKAY, and SCIPclockFree().
◆ SCIPnlpiInit()
void SCIPnlpiInit | ( | SCIP_NLPI * | nlpi | ) |
initializes NLPI
- Parameters
-
nlpi solver interface
Definition at line 211 of file nlpi.c.
References BMSclearMemoryArray, SCIP_Nlpi::evaltime, SCIP_Nlpi::niter, SCIP_Nlpi::nproblems, SCIP_Nlpi::nsolstat, SCIP_Nlpi::nsolves, SCIP_Nlpi::ntermstat, NULL, SCIP_Nlpi::problemtime, SCIP_NLPSOLSTAT_UNKNOWN, SCIP_NLPTERMSTAT_OTHER, SCIPclockReset(), and SCIP_Nlpi::solvetime.
◆ SCIPnlpiGetSolverPointer()
void * SCIPnlpiGetSolverPointer | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem | ||
) |
gets pointer for NLP solver
- Parameters
-
set global SCIP settings nlpi solver interface problem problem instance, or NULL
Definition at line 228 of file nlpi.c.
References NULL.
Referenced by SCIP_DECL_NLPIGETSOLVERPOINTER().
◆ SCIPnlpiCreateProblem()
SCIP_RETCODE SCIPnlpiCreateProblem | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM ** | problem, | ||
const char * | name | ||
) |
creates a problem instance
- Parameters
-
set global SCIP settings nlpi solver interface problem problem pointer to store the problem data name name of problem, can be NULL
Definition at line 244 of file nlpi.c.
References SCIP_Nlpi::nproblems, NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by SCIP_DECL_NLPICREATEPROBLEM(), SCIPcreateNlpiProblemFromNlRows(), and SCIPnlpCreate().
◆ SCIPnlpiFreeProblem()
SCIP_RETCODE SCIPnlpiFreeProblem | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM ** | problem | ||
) |
frees a problem instance
- Parameters
-
set global SCIP settings nlpi solver interface problem pointer where problem instance is stored
Definition at line 266 of file nlpi.c.
References NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by SCIP_DECL_NLPIFREEPROBLEM(), and SCIPnlpFree().
◆ SCIPnlpiGetProblemPointer()
void * SCIPnlpiGetProblemPointer | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem | ||
) |
gets pointer to solver-internal problem instance
- Parameters
-
set global SCIP settings nlpi solver interface problem problem instance
Definition at line 285 of file nlpi.c.
References NULL.
Referenced by SCIP_DECL_NLPIGETPROBLEMPOINTER().
◆ SCIPnlpiAddVars()
SCIP_RETCODE SCIPnlpiAddVars | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
int | nvars, | ||
const SCIP_Real * | lbs, | ||
const SCIP_Real * | ubs, | ||
const char ** | varnames | ||
) |
add variables to nlpi
- Parameters
-
set global SCIP settings nlpi solver interface problem 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 302 of file nlpi.c.
References NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by nlpFlushVarAdditions(), and SCIP_DECL_NLPIADDVARS().
◆ SCIPnlpiAddConstraints()
SCIP_RETCODE SCIPnlpiAddConstraints | ( | SCIP_SET * | set, |
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, | ||
SCIP_EXPR ** | exprs, | ||
const char ** | names | ||
) |
add constraints to nlpi
- Parameters
-
set global SCIP settings nlpi solver interface problem problem instance nconss number of constraints lhss left hand sides of constraints, can be NULL if -infinity rhss right hand sides of constraints, can be NULL if +infinity 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 exprs expressions for nonlinear part of constraints, entry of array may be NULL in case of no nonlinear part, may be NULL in case of no nonlinear part in any constraint names names of constraints, may be NULL or entries may be NULL
Definition at line 325 of file nlpi.c.
References NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by nlpFlushNlRowAdditions(), and SCIP_DECL_NLPIADDCONSTRAINTS().
◆ SCIPnlpiSetObjective()
SCIP_RETCODE SCIPnlpiSetObjective | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
int | nlins, | ||
const int * | lininds, | ||
const SCIP_Real * | linvals, | ||
SCIP_EXPR * | expr, | ||
const SCIP_Real | constant | ||
) |
sets or overwrites objective, a minimization problem is expected
- Parameters
-
set global SCIP settings nlpi solver interface problem 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 expr expression for nonlinear part of objective function, may be NULL in case of no nonlinear part constant objective value offset
Definition at line 352 of file nlpi.c.
References NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by nlpFlushObjective(), and SCIP_DECL_NLPISETOBJECTIVE().
◆ SCIPnlpiChgVarBounds()
SCIP_RETCODE SCIPnlpiChgVarBounds | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
const int | nvars, | ||
const int * | indices, | ||
const SCIP_Real * | lbs, | ||
const SCIP_Real * | ubs | ||
) |
change variable bounds
- Parameters
-
set global SCIP settings nlpi solver interface problem 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 376 of file nlpi.c.
References NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by nlpUpdateVarBounds(), SCIP_DECL_NLPICHGVARBOUNDS(), SCIPnlpChgVarBoundsDive(), SCIPnlpChgVarsBoundsDive(), and SCIPnlpEndDive().
◆ SCIPnlpiChgConsSides()
SCIP_RETCODE SCIPnlpiChgConsSides | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
int | nconss, | ||
const int * | indices, | ||
const SCIP_Real * | lhss, | ||
const SCIP_Real * | rhss | ||
) |
change constraint sides
- Parameters
-
set global SCIP settings nlpi solver interface problem 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 399 of file nlpi.c.
References NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by nlrowConstantChanged(), nlrowSideChanged(), and SCIP_DECL_NLPICHGCONSSIDES().
◆ SCIPnlpiDelVarSet()
SCIP_RETCODE SCIPnlpiDelVarSet | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
int * | dstats, | ||
int | dstatssize | ||
) |
delete a set of variables
- Parameters
-
set global SCIP settings nlpi solver interface problem problem instance dstats deletion status of vars; 1 if var should be deleted, 0 if not dstatssize size of the dstats array
Definition at line 422 of file nlpi.c.
References NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by nlpFlushVarDeletions(), and SCIP_DECL_NLPIDELVARSET().
◆ SCIPnlpiDelConsSet()
SCIP_RETCODE SCIPnlpiDelConsSet | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
int * | dstats, | ||
int | dstatssize | ||
) |
delete a set of constraints
- Parameters
-
set global SCIP settings nlpi solver interface problem problem instance dstats deletion status of constraints; 1 if constraint should be deleted, 0 if not dstatssize size of the dstats array
Definition at line 443 of file nlpi.c.
References NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by nlpFlushNlRowDeletions(), and SCIP_DECL_NLPIDELCONSSET().
◆ SCIPnlpiChgLinearCoefs()
SCIP_RETCODE SCIPnlpiChgLinearCoefs | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
int | idx, | ||
int | nvals, | ||
const int * | varidxs, | ||
const SCIP_Real * | vals | ||
) |
changes or adds linear coefficients in a constraint or objective
- Parameters
-
set global SCIP settings nlpi solver interface problem 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 464 of file nlpi.c.
References NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by nlpUpdateObjCoef(), nlrowLinearCoefChanged(), SCIP_DECL_NLPICHGLINEARCOEFS(), and SCIPnlpChgVarObjDive().
◆ SCIPnlpiChgExpr()
SCIP_RETCODE SCIPnlpiChgExpr | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
int | idxcons, | ||
SCIP_EXPR * | expr | ||
) |
change the expression in the nonlinear part
- Parameters
-
set global SCIP settings nlpi solver interface problem problem instance idxcons index of constraint or -1 for objective expr new expression for constraint or objective, or NULL to only remove previous tree
Definition at line 487 of file nlpi.c.
References NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by nlrowExprChanged(), and SCIP_DECL_NLPICHGEXPR().
◆ SCIPnlpiChgObjConstant()
SCIP_RETCODE SCIPnlpiChgObjConstant | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
SCIP_Real | objconstant | ||
) |
change the constant offset in the objective
- Parameters
-
set global SCIP settings nlpi solver interface problem problem instance objconstant new value for objective constant
Definition at line 508 of file nlpi.c.
References NULL, SCIP_Nlpi::problemtime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by SCIP_DECL_NLPICHGOBJCONSTANT().
◆ SCIPnlpiSetInitialGuess()
SCIP_RETCODE SCIPnlpiSetInitialGuess | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
SCIP_Real * | primalvalues, | ||
SCIP_Real * | consdualvalues, | ||
SCIP_Real * | varlbdualvalues, | ||
SCIP_Real * | varubdualvalues | ||
) |
sets initial guess for primal variables
- Parameters
-
set global SCIP settings nlpi solver interface problem 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 528 of file nlpi.c.
References NULL, SCIP_CALL, and SCIP_OKAY.
Referenced by nlpSolve(), SCIP_DECL_NLPISETINITIALGUESS(), and SCIPnlpSetInitialGuess().
◆ SCIPnlpiSolve()
SCIP_RETCODE SCIPnlpiSolve | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
SCIP_NLPPARAM * | param | ||
) |
tries to solve NLP
- Parameters
-
set global SCIP settings stat problem statistics nlpi solver interface problem problem instance param solve parameters
Definition at line 551 of file nlpi.c.
References SCIP_Nlpi::evaltime, SCIP_NlpStatistics::evaltime, SCIP_NlpParam::feastol, SCIP_NlpParam::iterlimit, SCIP_Nlpi::niter, SCIP_NlpStatistics::niterations, SCIP_Nlpi::nsolstat, SCIP_Nlpi::nsolves, SCIP_Nlpi::ntermstat, NULL, SCIP_NlpParam::opttol, SCIP_CALL, SCIP_OKAY, SCIP_PARAMETERWRONGVAL, SCIP_REAL_MAX, SCIPclockGetTime(), SCIPerrorMessage, SCIP_NlpParam::solvertol, SCIP_Nlpi::solvetime, SCIP_Stat::solvingtime, SCIP_NlpParam::timelimit, and SCIP_NlpStatistics::totaltime.
Referenced by nlpSolve(), and SCIP_DECL_NLPISOLVE().
◆ SCIPnlpiGetSolstat()
SCIP_NLPSOLSTAT SCIPnlpiGetSolstat | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem | ||
) |
gives solution status
- Parameters
-
set global SCIP settings nlpi solver interface problem problem instance
Definition at line 621 of file nlpi.c.
References NULL.
Referenced by nlpSolve(), and SCIP_DECL_NLPIGETSOLSTAT().
◆ SCIPnlpiGetTermstat()
SCIP_NLPTERMSTAT SCIPnlpiGetTermstat | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem | ||
) |
gives termination reason
- Parameters
-
set global SCIP settings nlpi solver interface problem problem instance
Definition at line 636 of file nlpi.c.
References NULL.
Referenced by nlpSolve(), and SCIP_DECL_NLPIGETTERMSTAT().
◆ SCIPnlpiGetSolution()
SCIP_RETCODE SCIPnlpiGetSolution | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
SCIP_Real ** | primalvalues, | ||
SCIP_Real ** | consdualvalues, | ||
SCIP_Real ** | varlbdualvalues, | ||
SCIP_Real ** | varubdualvalues, | ||
SCIP_Real * | objval | ||
) |
gives primal and dual solution 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
- Parameters
-
set global SCIP settings nlpi solver interface problem 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 to store the objective value, or NULL if not needed
Definition at line 653 of file nlpi.c.
References NULL, SCIP_CALL, and SCIP_OKAY.
Referenced by nlpSolve(), and SCIP_DECL_NLPIGETSOLUTION().
◆ SCIPnlpiGetStatistics()
SCIP_RETCODE SCIPnlpiGetStatistics | ( | SCIP_SET * | set, |
SCIP_NLPI * | nlpi, | ||
SCIP_NLPIPROBLEM * | problem, | ||
SCIP_NLPSTATISTICS * | statistics | ||
) |
gives solve statistics
- Parameters
-
set global SCIP settings nlpi solver interface problem problem instance statistics pointer to store statistics
Definition at line 675 of file nlpi.c.
References NULL, SCIP_CALL, and SCIP_OKAY.
Referenced by SCIP_DECL_NLPIGETSTATISTICS(), and SCIPnlpGetStatistics().