Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

implementation of NLPI oracle interface

Author
Stefan Vigerske

Definition in file nlpioracle.c.

#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "nlpi/nlpioracle.h"
#include "nlpi/pub_expr.h"
#include "nlpi/exprinterpret.h"
#include <string.h>

Go to the source code of this file.

Data Structures

struct  SCIP_NlpiOracleCons
 
struct  SCIP_NlpiOracle
 

Typedefs

NLPI Oracle data structures
typedef struct SCIP_NlpiOracleCons SCIP_NLPIORACLECONS
 

Functions

Local functions
static int calcGrowSize (int num)
 
static SCIP_RETCODE ensureVarsSize (SCIP_NLPIORACLE *oracle, int minsize)
 
static SCIP_RETCODE ensureConssSize (SCIP_NLPIORACLE *oracle, int minsize)
 
static SCIP_RETCODE ensureConsLinSize (BMS_BLKMEM *blkmem, SCIP_NLPIORACLECONS *cons, int minsize)
 
static SCIP_RETCODE ensureConsQuadSize (BMS_BLKMEM *blkmem, SCIP_NLPIORACLECONS *cons, int minsize)
 
static SCIP_RETCODE ensureIntArraySize (BMS_BLKMEM *blkmem, int **intarray, int *len, int minsize)
 
static void invalidateJacobiSparsity (SCIP_NLPIORACLE *oracle)
 
static void invalidateHessianLagSparsity (SCIP_NLPIORACLE *oracle)
 
static void sortLinearCoefficients (int *nidxs, int *idxs, SCIP_Real *coefs)
 
static SCIP_RETCODE createConstraint (BMS_BLKMEM *blkmem, SCIP_NLPIORACLECONS **cons, int nlinidxs, const int *linidxs, const SCIP_Real *lincoefs, int nquadelems, const SCIP_QUADELEM *quadelems, const int *exprvaridxs, const SCIP_EXPRTREE *exprtree, SCIP_Real lhs, SCIP_Real rhs, const char *name)
 
static void freeConstraint (BMS_BLKMEM *blkmem, SCIP_NLPIORACLECONS **cons)
 
static void freeConstraints (SCIP_NLPIORACLE *oracle)
 
static SCIP_RETCODE moveVariable (SCIP_NLPIORACLE *oracle, int fromidx, int toidx)
 
static void freeVariables (SCIP_NLPIORACLE *oracle)
 
static void updateVariableDegreesCons (SCIP_NLPIORACLE *oracle, SCIP_NLPIORACLECONS *cons)
 
static void updateVariableDegrees (SCIP_NLPIORACLE *oracle)
 
static void mapIndices (int *indexmap, int nindices, int *indices)
 
static void clearDeletedLinearElements (BMS_BLKMEM *blkmem, int **linidxs, SCIP_Real **coefs, int *nidxs)
 
static void clearDeletedQuadElements (BMS_BLKMEM *blkmem, SCIP_QUADELEM **quadelems, int *nquadelems)
 
static void mapIndicesQuad (int *indexmap, int nelems, SCIP_QUADELEM *elems)
 
static SCIP_RETCODE evalFunctionValue (SCIP_NLPIORACLE *oracle, SCIP_NLPIORACLECONS *cons, const SCIP_Real *x, SCIP_Real *val)
 
static SCIP_RETCODE evalFunctionGradient (SCIP_NLPIORACLE *oracle, SCIP_NLPIORACLECONS *cons, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real *RESTRICT val, SCIP_Real *RESTRICT grad)
 
static SCIP_RETCODE hessLagSparsitySetNzFlagForQuad (SCIP_NLPIORACLE *oracle, int **colnz, int *collen, int *colnnz, int *nzcount, int length, SCIP_QUADELEM *quadelems)
 
static SCIP_RETCODE hessLagSparsitySetNzFlagForExprtree (SCIP_NLPIORACLE *oracle, int **colnz, int *collen, int *colnnz, int *nzcount, int *exprvaridx, SCIP_EXPRTREE *exprtree, int dim)
 
static SCIP_RETCODE hessLagAddQuad (SCIP_Real weight, int length, SCIP_QUADELEM *quadelems, int *hesoffset, int *hescol, SCIP_Real *values)
 
static SCIP_RETCODE hessLagAddExprtree (SCIP_NLPIORACLE *oracle, SCIP_Real weight, const SCIP_Real *x, SCIP_Bool new_x, int *exprvaridx, SCIP_EXPRTREE *exprtree, int *hesoffset, int *hescol, SCIP_Real *values)
 
static void printName (char *buffer, char *name, int idx, char prefix, const char *suffix, SCIP_Bool longnames)
 
static SCIP_RETCODE printFunction (SCIP_NLPIORACLE *oracle, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, SCIP_NLPIORACLECONS *cons, SCIP_Bool longvarnames)
 
static SCIP_Bool exprIsNonSmooth (SCIP_EXPR *expr)
 
public function
SCIP_RETCODE SCIPnlpiOracleCreate (BMS_BLKMEM *blkmem, SCIP_NLPIORACLE **oracle)
 
SCIP_RETCODE SCIPnlpiOracleFree (SCIP_NLPIORACLE **oracle)
 
SCIP_RETCODE SCIPnlpiOracleSetInfinity (SCIP_NLPIORACLE *oracle, SCIP_Real infinity)
 
SCIP_Real SCIPnlpiOracleGetInfinity (SCIP_NLPIORACLE *oracle)
 
SCIP_RETCODE SCIPnlpiOracleSetProblemName (SCIP_NLPIORACLE *oracle, const char *name)
 
const char * SCIPnlpiOracleGetProblemName (SCIP_NLPIORACLE *oracle)
 
SCIP_RETCODE SCIPnlpiOracleAddVars (SCIP_NLPIORACLE *oracle, int nvars, const SCIP_Real *lbs, const SCIP_Real *ubs, const char **varnames)
 
SCIP_RETCODE SCIPnlpiOracleAddConstraints (SCIP_NLPIORACLE *oracle, 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 **consnames)
 
SCIP_RETCODE SCIPnlpiOracleSetObjective (SCIP_NLPIORACLE *oracle, const SCIP_Real constant, int nlin, const int *lininds, const SCIP_Real *linvals, int nquadelems, const SCIP_QUADELEM *quadelems, const int *exprvaridxs, const SCIP_EXPRTREE *exprtree)
 
SCIP_RETCODE SCIPnlpiOracleChgVarBounds (SCIP_NLPIORACLE *oracle, int nvars, const int *indices, const SCIP_Real *lbs, const SCIP_Real *ubs)
 
SCIP_RETCODE SCIPnlpiOracleChgConsSides (SCIP_NLPIORACLE *oracle, int nconss, const int *indices, const SCIP_Real *lhss, const SCIP_Real *rhss)
 
SCIP_RETCODE SCIPnlpiOracleDelVarSet (SCIP_NLPIORACLE *oracle, int *delstats)
 
SCIP_RETCODE SCIPnlpiOracleDelConsSet (SCIP_NLPIORACLE *oracle, int *delstats)
 
SCIP_RETCODE SCIPnlpiOracleChgLinearCoefs (SCIP_NLPIORACLE *oracle, int considx, int nentries, const int *varidxs, const SCIP_Real *newcoefs)
 
SCIP_RETCODE SCIPnlpiOracleChgQuadCoefs (SCIP_NLPIORACLE *oracle, int considx, int nquadelems, const SCIP_QUADELEM *quadelems)
 
SCIP_RETCODE SCIPnlpiOracleChgExprtree (SCIP_NLPIORACLE *oracle, int considx, const int *exprvaridxs, const SCIP_EXPRTREE *exprtree)
 
SCIP_RETCODE SCIPnlpiOracleChgExprParam (SCIP_NLPIORACLE *oracle, int considx, int paramidx, SCIP_Real paramval)
 
SCIP_RETCODE SCIPnlpiOracleChgObjConstant (SCIP_NLPIORACLE *oracle, SCIP_Real objconstant)
 
int SCIPnlpiOracleGetNVars (SCIP_NLPIORACLE *oracle)
 
int SCIPnlpiOracleGetNConstraints (SCIP_NLPIORACLE *oracle)
 
const SCIP_RealSCIPnlpiOracleGetVarLbs (SCIP_NLPIORACLE *oracle)
 
const SCIP_RealSCIPnlpiOracleGetVarUbs (SCIP_NLPIORACLE *oracle)
 
char ** SCIPnlpiOracleGetVarNames (SCIP_NLPIORACLE *oracle)
 
int SCIPnlpiOracleGetVarDegree (SCIP_NLPIORACLE *oracle, int varidx)
 
int * SCIPnlpiOracleGetVarDegrees (SCIP_NLPIORACLE *oracle)
 
SCIP_Real SCIPnlpiOracleGetConstraintLhs (SCIP_NLPIORACLE *oracle, int considx)
 
SCIP_Real SCIPnlpiOracleGetConstraintRhs (SCIP_NLPIORACLE *oracle, int considx)
 
char * SCIPnlpiOracleGetConstraintName (SCIP_NLPIORACLE *oracle, int considx)
 
int SCIPnlpiOracleGetConstraintDegree (SCIP_NLPIORACLE *oracle, int considx)
 
int SCIPnlpiOracleGetMaxDegree (SCIP_NLPIORACLE *oracle)
 
SCIP_EXPRINTCAPABILITY SCIPnlpiOracleGetEvalCapability (SCIP_NLPIORACLE *oracle)
 
SCIP_RETCODE SCIPnlpiOracleEvalObjectiveValue (SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Real *objval)
 
SCIP_RETCODE SCIPnlpiOracleEvalConstraintValue (SCIP_NLPIORACLE *oracle, int considx, const SCIP_Real *x, SCIP_Real *conval)
 
SCIP_RETCODE SCIPnlpiOracleEvalConstraintValues (SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Real *convals)
 
SCIP_RETCODE SCIPnlpiOracleEvalObjectiveGradient (SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real *objval, SCIP_Real *objgrad)
 
SCIP_RETCODE SCIPnlpiOracleEvalConstraintGradient (SCIP_NLPIORACLE *oracle, const int considx, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real *conval, SCIP_Real *congrad)
 
SCIP_RETCODE SCIPnlpiOracleGetJacobianSparsity (SCIP_NLPIORACLE *oracle, const int **offset, const int **col)
 
SCIP_RETCODE SCIPnlpiOracleEvalJacobian (SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real *convals, SCIP_Real *jacobi)
 
SCIP_RETCODE SCIPnlpiOracleGetHessianLagSparsity (SCIP_NLPIORACLE *oracle, const int **offset, const int **col)
 
SCIP_RETCODE SCIPnlpiOracleEvalHessianLag (SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real objfactor, const SCIP_Real *lambda, SCIP_Real *hessian)
 
SCIP_RETCODE SCIPnlpiOraclePrintProblem (SCIP_NLPIORACLE *oracle, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
 
SCIP_RETCODE SCIPnlpiOraclePrintProblemGams (SCIP_NLPIORACLE *oracle, SCIP_Real *initval, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
 

Typedef Documentation

◆ SCIP_NLPIORACLECONS

Definition at line 56 of file nlpioracle.c.

Function Documentation

◆ calcGrowSize()

static int calcGrowSize ( int  num)
static

calculate memory size for dynamically allocated arrays (copied from scip/set.c)

Parameters
numminimum number of entries to store

Definition at line 95 of file nlpioracle.c.

Referenced by ensureConsLinSize(), ensureConsQuadSize(), ensureConssSize(), ensureIntArraySize(), and ensureVarsSize().

◆ ensureVarsSize()

static SCIP_RETCODE ensureVarsSize ( SCIP_NLPIORACLE oracle,
int  minsize 
)
static

ensures that variables related arrays in oracle have at least a given length

Parameters
oracleNLPIORACLE data structure
minsizeminimal required size

Definition at line 111 of file nlpioracle.c.

References SCIP_NlpiOracle::blkmem, BMSreallocBlockMemoryArray, calcGrowSize(), NULL, SCIP_ALLOC, SCIP_OKAY, SCIP_NlpiOracle::vardegrees, SCIP_NlpiOracle::varlbs, SCIP_NlpiOracle::varnames, SCIP_NlpiOracle::varssize, and SCIP_NlpiOracle::varubs.

Referenced by SCIPnlpiOracleAddVars().

◆ ensureConssSize()

static SCIP_RETCODE ensureConssSize ( SCIP_NLPIORACLE oracle,
int  minsize 
)
static

ensures that constraints array in oracle has at least a given length

Parameters
oracleNLPIORACLE data structure
minsizeminimal required size

Definition at line 142 of file nlpioracle.c.

References SCIP_NlpiOracle::blkmem, BMSreallocBlockMemoryArray, calcGrowSize(), SCIP_NlpiOracle::conss, SCIP_NlpiOracle::consssize, NULL, SCIP_ALLOC, and SCIP_OKAY.

Referenced by SCIPnlpiOracleAddConstraints().

◆ ensureConsLinSize()

static SCIP_RETCODE ensureConsLinSize ( BMS_BLKMEM blkmem,
SCIP_NLPIORACLECONS cons,
int  minsize 
)
static

ensures that arrays for linear part in a oracle constraints have at least a given length

Parameters
blkmemblock memory
consoracle constraint
minsizeminimal required size

Definition at line 166 of file nlpioracle.c.

References BMSreallocBlockMemoryArray, calcGrowSize(), SCIP_NlpiOracleCons::lincoefs, SCIP_NlpiOracleCons::linidxs, SCIP_NlpiOracleCons::linsize, NULL, SCIP_ALLOC, and SCIP_OKAY.

Referenced by SCIPnlpiOracleChgLinearCoefs().

◆ ensureConsQuadSize()

static SCIP_RETCODE ensureConsQuadSize ( BMS_BLKMEM blkmem,
SCIP_NLPIORACLECONS cons,
int  minsize 
)
static

ensures that arrays for quadratic part in a oracle constraints have at least a given length

Parameters
blkmemblock memory
consoracle constraint
minsizeminimal required size

Definition at line 193 of file nlpioracle.c.

References BMSreallocBlockMemoryArray, calcGrowSize(), NULL, SCIP_NlpiOracleCons::quadelems, SCIP_NlpiOracleCons::quadsize, SCIP_ALLOC, and SCIP_OKAY.

Referenced by SCIPnlpiOracleChgQuadCoefs().

◆ ensureIntArraySize()

static SCIP_RETCODE ensureIntArraySize ( BMS_BLKMEM blkmem,
int **  intarray,
int *  len,
int  minsize 
)
static

ensures that a given array of integers has at least a given length

Parameters
blkmemblock memory
intarrayarray of integers
lenlength of array (modified if reallocated)
minsizeminimal required array length

Definition at line 219 of file nlpioracle.c.

References BMSreallocBlockMemoryArray, calcGrowSize(), NULL, SCIP_ALLOC, and SCIP_OKAY.

Referenced by hessLagSparsitySetNzFlagForExprtree(), hessLagSparsitySetNzFlagForQuad(), and SCIPnlpiOracleGetJacobianSparsity().

◆ invalidateJacobiSparsity()

static void invalidateJacobiSparsity ( SCIP_NLPIORACLE oracle)
static

Invalidates the sparsity pattern of the Jacobian. Should be called when constraints are added or deleted.

Parameters
oraclepointer to store NLPIORACLE data structure

Definition at line 249 of file nlpioracle.c.

References BMSfreeBlockMemoryArray, NULL, and SCIPdebugMessage.

Referenced by SCIPnlpiOracleAddConstraints(), SCIPnlpiOracleChgExprtree(), SCIPnlpiOracleChgLinearCoefs(), SCIPnlpiOracleChgQuadCoefs(), SCIPnlpiOracleDelConsSet(), SCIPnlpiOracleDelVarSet(), and SCIPnlpiOracleFree().

◆ invalidateHessianLagSparsity()

static void invalidateHessianLagSparsity ( SCIP_NLPIORACLE oracle)
static

Invalidates the sparsity pattern of the Hessian of the Lagragian. Should be called when the objective is set or constraints are added or deleted.

Parameters
oraclepointer to store NLPIORACLE data structure

Definition at line 272 of file nlpioracle.c.

References BMSfreeBlockMemoryArray, NULL, and SCIPdebugMessage.

Referenced by SCIPnlpiOracleAddConstraints(), SCIPnlpiOracleAddVars(), SCIPnlpiOracleChgExprtree(), SCIPnlpiOracleChgQuadCoefs(), SCIPnlpiOracleDelConsSet(), SCIPnlpiOracleDelVarSet(), SCIPnlpiOracleFree(), and SCIPnlpiOracleSetObjective().

◆ sortLinearCoefficients()

static void sortLinearCoefficients ( int *  nidxs,
int *  idxs,
SCIP_Real coefs 
)
static

sorts a linear term, merges duplicate entries and removes entries with coefficient 0.0

Parameters
nidxsnumber of variables
idxsindices of variables
coefscoefficients of variables

Definition at line 293 of file nlpioracle.c.

References NULL, and SCIPsortIntReal().

Referenced by createConstraint(), and SCIPnlpiOracleChgLinearCoefs().

◆ createConstraint()

static SCIP_RETCODE createConstraint ( BMS_BLKMEM blkmem,
SCIP_NLPIORACLECONS **  cons,
int  nlinidxs,
const int *  linidxs,
const SCIP_Real lincoefs,
int  nquadelems,
const SCIP_QUADELEM quadelems,
const int *  exprvaridxs,
const SCIP_EXPRTREE exprtree,
SCIP_Real  lhs,
SCIP_Real  rhs,
const char *  name 
)
static

creates a NLPI constraint from given constraint data

Parameters
blkmemblock memory
consbuffer where to store pointer to constraint
nlinidxslength of linear part
linidxsindices of linear part, or NULL if nlinidxs == 0
lincoefscoefficients of linear part, or NULL if nlinidxs == 0
nquadelemslenght of quadratic part
quadelemsquadratic elements, or NULL if nquadelems == 0
exprvaridxsindicies of variables in expression tree, or NULL if exprtree == NULL
exprtreeexpression tree, or NULL
lhsleft-hand-side of constraint
rhsright-hand-side of constraint
namename of constraint, or NULL

Definition at line 342 of file nlpioracle.c.

References BMSallocBlockMemory, BMSclearMemory, BMSduplicateBlockMemoryArray, EPSEQ, EPSLE, SCIP_NlpiOracleCons::lhs, SCIP_NlpiOracleCons::nlinidxs, SCIP_NlpiOracleCons::nquadelems, NULL, SCIP_NlpiOracleCons::rhs, SCIP_ALLOC, SCIP_CALL, SCIP_DEFAULT_EPSILON, SCIP_OKAY, SCIPexprtreeCopy(), SCIPexprtreeGetNVars(), SCIPquadelemSort(), SCIPquadelemSqueeze(), and sortLinearCoefficients().

Referenced by SCIPnlpiOracleAddConstraints(), SCIPnlpiOracleCreate(), and SCIPnlpiOracleSetObjective().

◆ freeConstraint()

static void freeConstraint ( BMS_BLKMEM blkmem,
SCIP_NLPIORACLECONS **  cons 
)
static

frees a constraint

Parameters
blkmemblock memory
conspointer to constraint that should be freed

Definition at line 421 of file nlpioracle.c.

References BMSfreeBlockMemory, BMSfreeBlockMemoryArrayNull, NULL, SCIP_CALL_ABORT, SCIPdebugMessage, SCIPexprtreeFree(), and SCIPexprtreeGetNVars().

Referenced by freeConstraints(), SCIPnlpiOracleDelConsSet(), SCIPnlpiOracleFree(), and SCIPnlpiOracleSetObjective().

◆ freeConstraints()

static void freeConstraints ( SCIP_NLPIORACLE oracle)
static

frees all constraints

Parameters
oraclepointer to store NLPIORACLE data structure

Definition at line 454 of file nlpioracle.c.

References BMSfreeBlockMemoryArrayNull, freeConstraint(), NULL, and SCIPdebugMessage.

Referenced by SCIPnlpiOracleDelConsSet(), and SCIPnlpiOracleFree().

◆ moveVariable()

static SCIP_RETCODE moveVariable ( SCIP_NLPIORACLE oracle,
int  fromidx,
int  toidx 
)
static

moves one variable The place where it moves to need to be empty (all NULL) but allocated. Note that this function does not update the variable indices in the constraints!

Parameters
oraclepointer to store NLPIORACLE data structure
fromidxindex of variable to move
toidxindex of place where to move variable to

Definition at line 480 of file nlpioracle.c.

References NULL, SCIP_OKAY, and SCIPdebugMessage.

Referenced by SCIPnlpiOracleDelVarSet().

◆ freeVariables()

static void freeVariables ( SCIP_NLPIORACLE oracle)
static

frees all variables

Parameters
oraclepointer to store NLPIORACLE data structure

Definition at line 520 of file nlpioracle.c.

References BMSfreeBlockMemoryArray, BMSfreeBlockMemoryArrayNull, NULL, SCIPdebugMessage, and TRUE.

Referenced by SCIPnlpiOracleDelVarSet(), and SCIPnlpiOracleFree().

◆ updateVariableDegreesCons()

static void updateVariableDegreesCons ( SCIP_NLPIORACLE oracle,
SCIP_NLPIORACLECONS cons 
)
static

◆ updateVariableDegrees()

static void updateVariableDegrees ( SCIP_NLPIORACLE oracle)
static

Updates the degrees of all variables.

Parameters
oraclepointer to store NLPIORACLE data structure

Definition at line 586 of file nlpioracle.c.

References BMSclearMemoryArray, NULL, SCIP_NlpiOracle::nvars, SCIP_NlpiOracle::objective, SCIPdebugMessage, TRUE, updateVariableDegreesCons(), and SCIP_NlpiOracle::vardegrees.

Referenced by SCIPnlpiOracleGetMaxDegree(), SCIPnlpiOracleGetVarDegree(), and SCIPnlpiOracleGetVarDegrees().

◆ mapIndices()

static void mapIndices ( int *  indexmap,
int  nindices,
int *  indices 
)
static

applies a mapping of indices to one array of indices

Parameters
indexmapmapping from old variable indices to new indices
nindicesnumber of indices in indices1 and indices2
indicesarray of indices to adjust

Definition at line 613 of file nlpioracle.c.

References NULL.

Referenced by SCIPnlpiOracleDelVarSet().

◆ clearDeletedLinearElements()

static void clearDeletedLinearElements ( BMS_BLKMEM blkmem,
int **  linidxs,
SCIP_Real **  coefs,
int *  nidxs 
)
static

removes entries with index -1 (marked as deleted) from array of linear elements assumes that array is sorted by index, i.e., all -1 are at the beginning

Parameters
blkmemblock memory
linidxsvariable indices
coefsvariable coefficients
nidxsnumber of indices

Definition at line 633 of file nlpioracle.c.

References NULL, and SCIPdebugMessage.

Referenced by SCIPnlpiOracleDelVarSet().

◆ clearDeletedQuadElements()

static void clearDeletedQuadElements ( BMS_BLKMEM blkmem,
SCIP_QUADELEM **  quadelems,
int *  nquadelems 
)
static

removes entries with index pair (-1,-1) (marked as deleted) from array of quadratic elements assumes that array is sorted, i.e., all deleted elements are at the beginning

Parameters
blkmemblock memory
quadelemsquadratic elements
nquadelemsnumber of quadratic elements

Definition at line 675 of file nlpioracle.c.

References SCIP_NlpiOracleCons::nquadelems, NULL, and SCIPdebugMessage.

Referenced by SCIPnlpiOracleDelVarSet().

◆ mapIndicesQuad()

static void mapIndicesQuad ( int *  indexmap,
int  nelems,
SCIP_QUADELEM elems 
)
static

applies a mapping of indices to an array of quadratic elements

Parameters
indexmapmapping from old variable indices to new indices
nelemsnumber of quadratic elements
elemsarray of quadratic elements to adjust

Definition at line 713 of file nlpioracle.c.

References SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, and NULL.

Referenced by SCIPnlpiOracleDelVarSet().

◆ evalFunctionValue()

◆ evalFunctionGradient()

static SCIP_RETCODE evalFunctionGradient ( SCIP_NLPIORACLE oracle,
SCIP_NLPIORACLECONS cons,
const SCIP_Real x,
SCIP_Bool  isnewx,
SCIP_Real *RESTRICT  val,
SCIP_Real *RESTRICT  grad 
)
static

computes the value and gradient of a function

Returns
SCIP_INVALIDDATA, if the function or its gradient could not be evaluated (domain error, etc.)
Parameters
oraclepointer to NLPIORACLE data structure
consoracle constraint
xthe point where to evaluate
isnewxhas the point x changed since the last call to some evaluation function?
valpointer to store function value
gradpointer to store function gradient

Definition at line 821 of file nlpioracle.c.

References BMSallocBlockMemoryArray, BMSclearMemoryArray, BMSfreeBlockMemoryArray, BMSfreeBlockMemoryArrayNull, SCIP_QuadElement::coef, SCIP_NlpiOracleCons::exprtree, SCIP_NlpiOracleCons::exprvaridxs, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_NlpiOracleCons::lincoefs, SCIP_NlpiOracleCons::linidxs, SCIP_NlpiOracleCons::nlinidxs, SCIP_NlpiOracleCons::nquadelems, NULL, SCIP_NlpiOracle::nvars, SCIP_NlpiOracleCons::quadelems, SCIP_ALLOC, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPdebug, SCIPdebugMessage, SCIPexprintGrad(), SCIPexprtreeGetNVars(), and SCIPisFinite.

Referenced by SCIPnlpiOracleEvalConstraintGradient(), and SCIPnlpiOracleEvalObjectiveGradient().

◆ hessLagSparsitySetNzFlagForQuad()

static SCIP_RETCODE hessLagSparsitySetNzFlagForQuad ( SCIP_NLPIORACLE oracle,
int **  colnz,
int *  collen,
int *  colnnz,
int *  nzcount,
int  length,
SCIP_QUADELEM quadelems 
)
static

collects nonzeros entries in colnz and increases the nzcount given indices of quadratic terms

Parameters
oracleNLPI oracle
colnzindices of nonzero entries for each column
collenspace allocated to store indices of nonzeros for each column
colnnznumber of nonzero entries for each column
nzcountcounter for total number of nonzeros; should be increased whenever some colnnz is increased
lengthlength of quadratic part
quadelemsquadratic elements

Definition at line 945 of file nlpioracle.c.

References ensureIntArraySize(), SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, NULL, SCIP_NlpiOracleCons::quadelems, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPsortedvecFindInt(), and SCIPsortedvecInsertInt().

Referenced by SCIPnlpiOracleGetHessianLagSparsity().

◆ hessLagSparsitySetNzFlagForExprtree()

static SCIP_RETCODE hessLagSparsitySetNzFlagForExprtree ( SCIP_NLPIORACLE oracle,
int **  colnz,
int *  collen,
int *  colnnz,
int *  nzcount,
int *  exprvaridx,
SCIP_EXPRTREE exprtree,
int  dim 
)
static

collects indices of nonzero entries in the lower-left part of the hessian matrix of an expression adds the indices to a given set of indices, avoiding duplicates

Parameters
oracleNLPI oracle
colnzindices of nonzero entries for each column
collenspace allocated to store indices of nonzeros for each column
colnnznumber of nonzero entries for each column
nzcountcounter for total number of nonzeros; should be increased when nzflag is set to 1 the first time
exprvaridxindices of variables from expression tree in NLP
exprtreeexpression tree
dimdimension of matrix

Definition at line 985 of file nlpioracle.c.

References BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, ensureIntArraySize(), MAX, NULL, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPexprintHessianSparsityDense(), SCIPexprtreeGetNVars(), SCIPsortedvecFindInt(), SCIPsortedvecInsertInt(), and x.

Referenced by SCIPnlpiOracleGetHessianLagSparsity().

◆ hessLagAddQuad()

static SCIP_RETCODE hessLagAddQuad ( SCIP_Real  weight,
int  length,
SCIP_QUADELEM quadelems,
int *  hesoffset,
int *  hescol,
SCIP_Real values 
)
static

adds quadratic part into hessian structure

Parameters
weightweight of quadratic part
lengthnumber of elements in matrix of quadratic part
quadelemselements in matrix of quadratic part
hesoffsetrow offsets in sparse matrix that is to be filled
hescolcolumn indices in sparse matrix that is to be filled
valuesbuffer for values of sparse matrix that is to be filled

Definition at line 1056 of file nlpioracle.c.

References SCIP_QuadElement::coef, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, NULL, SCIP_NlpiOracleCons::quadelems, SCIP_ERROR, SCIP_OKAY, SCIPdebugMessage, SCIPerrorMessage, and SCIPsortedvecFindInt().

Referenced by SCIPnlpiOracleEvalHessianLag().

◆ hessLagAddExprtree()

static SCIP_RETCODE hessLagAddExprtree ( SCIP_NLPIORACLE oracle,
SCIP_Real  weight,
const SCIP_Real x,
SCIP_Bool  new_x,
int *  exprvaridx,
SCIP_EXPRTREE exprtree,
int *  hesoffset,
int *  hescol,
SCIP_Real values 
)
static

adds hessian of an expression into hessian structure

Parameters
oracleoracle
weightweight of quadratic part
xpoint for which hessian should be returned
new_xwhether point has been evaluated before
exprvaridxNLP indices for variables in expression tree
exprtreeexpression tree
hesoffsetrow offsets in sparse matrix that is to be filled
hescolcolumn indices in sparse matrix that is to be filled
valuesbuffer for values of sparse matrix that is to be filled

Definition at line 1091 of file nlpioracle.c.

References BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, BMSfreeBlockMemoryArrayNull, FALSE, h, MAX, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_ERROR, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPerrorMessage, SCIPexprintHessianDense(), SCIPexprtreeGetNVars(), SCIPisFinite, and SCIPsortedvecFindInt().

Referenced by SCIPnlpiOracleEvalHessianLag().

◆ printName()

static void printName ( char *  buffer,
char *  name,
int  idx,
char  prefix,
const char *  suffix,
SCIP_Bool  longnames 
)
static

prints a name, if available, makes sure it has not more than 64 characters, and adds a unique prefix if the longnames flag is set

Parameters
bufferbuffer to print to, has to be not NULL and should be at least 65 bytes
namename, or NULL
idxindex of var or cons which the name corresponds to
prefixa letter (typically 'x' or 'e') to distinguish variable and equation names, if names[idx] is not available
suffixa suffer to add to the name, or NULL
longnameswhether prefixes for long names should be added

Definition at line 1194 of file nlpioracle.c.

References NULL, and SCIPsnprintf().

Referenced by printFunction(), and SCIPnlpiOraclePrintProblemGams().

◆ printFunction()

static SCIP_RETCODE printFunction ( SCIP_NLPIORACLE oracle,
SCIP_MESSAGEHDLR messagehdlr,
FILE *  file,
SCIP_NLPIORACLECONS cons,
SCIP_Bool  longvarnames 
)
static

prints a function

Parameters
oraclepointer to NLPIORACLE data structure
messagehdlrmessage handler
filefile to print to, has to be not NULL
consconstraint which function to print
longvarnameswhether variable names need to be shorten to 64 characters

Definition at line 1229 of file nlpioracle.c.

References BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, SCIP_QuadElement::coef, SCIP_NlpiOracleCons::exprtree, SCIP_NlpiOracleCons::exprvaridxs, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_NlpiOracleCons::lincoefs, SCIP_NlpiOracleCons::linidxs, SCIP_NlpiOracleCons::nlinidxs, SCIP_NlpiOracleCons::nquadelems, NULL, printName(), SCIP_NlpiOracleCons::quadelems, SCIP_ALLOC, SCIP_OKAY, SCIPdebugMessage, SCIPexprtreeGetNVars(), SCIPexprtreePrint(), and SCIPmessageFPrintInfo().

Referenced by SCIPnlpiOraclePrintProblem(), and SCIPnlpiOraclePrintProblemGams().

◆ exprIsNonSmooth()

static SCIP_Bool exprIsNonSmooth ( SCIP_EXPR expr)
static

returns whether an expression is contains nonsmooth operands (min, max, abs, ...)

Parameters
exprexpression

Definition at line 1292 of file nlpioracle.c.

References FALSE, NULL, SCIP_EXPR_ABS, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPexprGetOperator(), and TRUE.

Referenced by SCIPnlpiOraclePrintProblemGams().

◆ SCIPnlpiOracleCreate()

SCIP_RETCODE SCIPnlpiOracleCreate ( BMS_BLKMEM blkmem,
SCIP_NLPIORACLE **  oracle 
)

creates an NLPIORACLE data structure

Parameters
blkmemblock memory
oraclepointer to store NLPIORACLE data structure

Definition at line 1328 of file nlpioracle.c.

References BMSallocMemory, BMSclearMemory, createConstraint(), NULL, SCIP_ALLOC, SCIP_CALL, SCIP_DEFAULT_INFINITY, SCIP_OKAY, SCIPdebugMessage, SCIPexprintCreate(), SCIPexprintGetName(), and TRUE.

Referenced by SCIP_DECL_NLPICREATEPROBLEM().

◆ SCIPnlpiOracleFree()

SCIP_RETCODE SCIPnlpiOracleFree ( SCIP_NLPIORACLE **  oracle)

frees an NLPIORACLE data structure

Parameters
oraclepointer to NLPIORACLE data structure

Definition at line 1355 of file nlpioracle.c.

References BMSfreeMemory, freeConstraint(), freeConstraints(), freeVariables(), invalidateHessianLagSparsity(), invalidateJacobiSparsity(), NULL, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPexprintFree(), and SCIPnlpiOracleSetProblemName().

Referenced by SCIP_DECL_NLPIFREEPROBLEM().

◆ SCIPnlpiOracleSetInfinity()

SCIP_RETCODE SCIPnlpiOracleSetInfinity ( SCIP_NLPIORACLE oracle,
SCIP_Real  infinity 
)

sets the value for infinity

Parameters
oraclepointer to NLPIORACLE data structure
infinityvalue to use for infinity

Definition at line 1384 of file nlpioracle.c.

References infinity, NULL, SCIP_OKAY, and SCIPdebugMessage.

Referenced by SCIP_DECL_NLPICREATEPROBLEM(), and SCIP_DECL_NLPISETREALPAR().

◆ SCIPnlpiOracleGetInfinity()

SCIP_Real SCIPnlpiOracleGetInfinity ( SCIP_NLPIORACLE oracle)

gets the value for infinity

Parameters
oraclepointer to NLPIORACLE data structure

Definition at line 1400 of file nlpioracle.c.

References NULL, and SCIPdebugMessage.

Referenced by SCIP_DECL_NLPIGETREALPAR(), and SCIP_DECL_NLPISOLVE().

◆ SCIPnlpiOracleSetProblemName()

SCIP_RETCODE SCIPnlpiOracleSetProblemName ( SCIP_NLPIORACLE oracle,
const char *  name 
)

sets the problem name (used for printing)

Parameters
oraclepointer to NLPIORACLE data structure
namename of problem

Definition at line 1412 of file nlpioracle.c.

References BMSduplicateBlockMemoryArray, BMSfreeBlockMemoryArray, NULL, SCIP_ALLOC, SCIP_OKAY, and SCIPdebugMessage.

Referenced by SCIP_DECL_NLPICREATEPROBLEM(), and SCIPnlpiOracleFree().

◆ SCIPnlpiOracleGetProblemName()

const char* SCIPnlpiOracleGetProblemName ( SCIP_NLPIORACLE oracle)

gets the problem name, or NULL if none set

Parameters
oraclepointer to NLPIORACLE data structure

Definition at line 1435 of file nlpioracle.c.

References NULL, and SCIPdebugMessage.

◆ SCIPnlpiOracleAddVars()

SCIP_RETCODE SCIPnlpiOracleAddVars ( SCIP_NLPIORACLE oracle,
int  nvars,
const SCIP_Real lbs,
const SCIP_Real ubs,
const char **  varnames 
)

adds variables

Parameters
oraclepointer to NLPIORACLE data structure
nvarsnumber of variables to add
lbsarray with lower bounds of new variables, or NULL if all -infinity
ubsarray with upper bounds of new variables, or NULL if all +infinity
varnamesarray with names of new variables, or NULL if no names should be stored

Definition at line 1447 of file nlpioracle.c.

References BMSallocBlockMemoryArray, BMSclearMemoryArray, BMScopyMemoryArray, BMSduplicateBlockMemoryArray, ensureVarsSize(), EPSEQ, invalidateHessianLagSparsity(), NULL, SCIP_ALLOC, SCIP_CALL, SCIP_DEFAULT_EPSILON, SCIP_OKAY, and SCIPdebugMessage.

Referenced by SCIP_DECL_NLPIADDVARS().

◆ SCIPnlpiOracleAddConstraints()

SCIP_RETCODE SCIPnlpiOracleAddConstraints ( SCIP_NLPIORACLE oracle,
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 **  consnames 
)

adds constraints

linear coefficients: row(=constraint) oriented matrix; quadratic coefficients: row oriented matrix for each constraint

Parameters
oraclepointer to NLPIORACLE data structure
nconssnumber of constraints to add
lhssarray with left-hand sides of constraints, or NULL if all -infinity
rhssarray with right-hand sides of constraints, or NULL if all +infinity
nlinindsnumber of linear coefficients for each constraint, may be NULL in case of no linear part
linindsindices of variables for linear coefficients for each constraint, may be NULL in case of no linear part
linvalsvalues of linear coefficient for each constraint, may be NULL in case of no linear part
nquadelemsnumber of elements in matrix of quadratic part for each constraint, may be NULL in case of no quadratic part in any constraint
quadelemsquadratic elements specifying quadratic part for each constraint, entry of array may be NULL in case of no quadratic part, may be NULL in case of no quadratic part in any constraint
exprvaridxsNULL if no nonquadratic parts, otherwise epxrvaridxs[.] maps variable indices in expression tree to indices in nlp
exprtreesNULL if no nonquadratic parts, otherwise exprtrees[.] gives nonquadratic part, or NULL if no nonquadratic part in this constraint
consnamesnames of new constraints, or NULL if no names should be stored

Definition at line 1532 of file nlpioracle.c.

References createConstraint(), ensureConssSize(), SCIP_NlpiOracleCons::exprtree, FALSE, invalidateHessianLagSparsity(), invalidateJacobiSparsity(), SCIP_NlpiOracleCons::nquadelems, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPexprintCompile(), TRUE, and updateVariableDegreesCons().

Referenced by SCIP_DECL_NLPIADDCONSTRAINTS().

◆ SCIPnlpiOracleSetObjective()

SCIP_RETCODE SCIPnlpiOracleSetObjective ( SCIP_NLPIORACLE oracle,
const SCIP_Real  constant,
int  nlin,
const int *  lininds,
const SCIP_Real linvals,
int  nquadelems,
const SCIP_QUADELEM quadelems,
const int *  exprvaridxs,
const SCIP_EXPRTREE exprtree 
)

sets or overwrites objective, a minimization problem is expected

May change sparsity pattern.

Parameters
oraclepointer to NLPIORACLE data structure
constantconstant part of objective
nlinnumber of linear variable coefficients
linindsindices of linear variables, or NULL if no linear part
linvalscoefficients of linear variables, or NULL if no linear part
nquadelemsnumber of entries in matrix of quadratic part
quadelemsentries in matrix of quadratic part, may be NULL in case of no quadratic part
exprvaridxsmaps variable indices in expression tree to indices in nlp, or NULL if no nonquadratic part
exprtreeexpression tree of nonquadratic part, or NULL if no nonquadratic part

Definition at line 1610 of file nlpioracle.c.

References createConstraint(), FALSE, freeConstraint(), SCIP_NlpiOracle::infinity, invalidateHessianLagSparsity(), NULL, REALABS, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, and SCIPexprintCompile().

Referenced by SCIP_DECL_NLPISETOBJECTIVE().

◆ SCIPnlpiOracleChgVarBounds()

SCIP_RETCODE SCIPnlpiOracleChgVarBounds ( SCIP_NLPIORACLE oracle,
int  nvars,
const int *  indices,
const SCIP_Real lbs,
const SCIP_Real ubs 
)

change variable bounds

Parameters
oraclepointer to NLPIORACLE data structure
nvarsnumber of variables to change bounds
indicesindices of variables to change bounds
lbsnew lower bounds, or NULL if all should be -infty
ubsnew upper bounds, or NULL if all should be +infty

Definition at line 1647 of file nlpioracle.c.

References EPSEQ, NULL, SCIP_DEFAULT_EPSILON, SCIP_OKAY, and SCIPdebugMessage.

Referenced by SCIP_DECL_NLPICHGVARBOUNDS().

◆ SCIPnlpiOracleChgConsSides()

SCIP_RETCODE SCIPnlpiOracleChgConsSides ( SCIP_NLPIORACLE oracle,
int  nconss,
const int *  indices,
const SCIP_Real lhss,
const SCIP_Real rhss 
)

change constraint bounds

Parameters
oraclepointer to NLPIORACLE data structure
nconssnumber of constraints to change bounds
indicesindices of constraints to change bounds
lhssnew left-hand sides, or NULL if all should be -infty
rhssnew right-hand sides, or NULL if all should be +infty

Definition at line 1683 of file nlpioracle.c.

References EPSEQ, NULL, SCIP_DEFAULT_EPSILON, SCIP_OKAY, and SCIPdebugMessage.

Referenced by SCIP_DECL_NLPICHGCONSSIDES().

◆ SCIPnlpiOracleDelVarSet()

◆ SCIPnlpiOracleDelConsSet()

SCIP_RETCODE SCIPnlpiOracleDelConsSet ( SCIP_NLPIORACLE oracle,
int *  delstats 
)

deletes a set of constraints

Parameters
oraclepointer to NLPIORACLE data structure
delstatsarray with deletion status of rows in input (1 if row should be deleted, 0 if not); new position of row in output (-1 if row was deleted)

Definition at line 1827 of file nlpioracle.c.

References FALSE, freeConstraint(), freeConstraints(), invalidateHessianLagSparsity(), invalidateJacobiSparsity(), NULL, SCIP_OKAY, and SCIPdebugMessage.

Referenced by SCIP_DECL_NLPIDELCONSSET().

◆ SCIPnlpiOracleChgLinearCoefs()

SCIP_RETCODE SCIPnlpiOracleChgLinearCoefs ( SCIP_NLPIORACLE oracle,
int  considx,
int  nentries,
const int *  varidxs,
const SCIP_Real newcoefs 
)

changes linear coefficients in one constraint or objective

Parameters
oraclepointer to NLPIORACLE data structure
considxindex of constraint where linear coefficients should be changed, or -1 for objective
nentriesnumber of coefficients to change
varidxsarray with indices of variables which coefficients should be changed
newcoefsarray with new coefficients of variables

Definition at line 1905 of file nlpioracle.c.

References BMSduplicateBlockMemoryArray, ensureConsLinSize(), FALSE, invalidateJacobiSparsity(), SCIP_NlpiOracleCons::lincoefs, SCIP_NlpiOracleCons::linidxs, SCIP_NlpiOracleCons::linsize, MAX, SCIP_NlpiOracleCons::nlinidxs, NULL, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPsortedvecFindInt(), sortLinearCoefficients(), and TRUE.

Referenced by SCIP_DECL_NLPICHGLINEARCOEFS().

◆ SCIPnlpiOracleChgQuadCoefs()

SCIP_RETCODE SCIPnlpiOracleChgQuadCoefs ( SCIP_NLPIORACLE oracle,
int  considx,
int  nquadelems,
const SCIP_QUADELEM quadelems 
)

changes (or adds) coefficients in the quadratic part of one constraint or objective

Parameters
oraclepointer to NLPIORACLE data structure
considxindex of constraint where quadratic coefficients should be changed, or -1 for objective
nquadelemsnumber of entries in quadratic constraint to change
quadelemsnew elements in quadratic matrix (replacing already existing ones or adding new ones)

Definition at line 2002 of file nlpioracle.c.

References BMSduplicateBlockMemoryArray, SCIP_QuadElement::coef, ensureConsQuadSize(), FALSE, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, invalidateHessianLagSparsity(), invalidateJacobiSparsity(), MAX, SCIP_NlpiOracleCons::nquadelems, NULL, SCIP_NlpiOracleCons::quadelems, SCIP_NlpiOracleCons::quadsize, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPquadelemSort(), SCIPquadelemSortedFind(), SCIPquadelemSqueeze(), and TRUE.

Referenced by SCIP_DECL_NLPICHGQUADCOEFS().

◆ SCIPnlpiOracleChgExprtree()

SCIP_RETCODE SCIPnlpiOracleChgExprtree ( SCIP_NLPIORACLE oracle,
int  considx,
const int *  exprvaridxs,
const SCIP_EXPRTREE exprtree 
)

replaces expression tree of one constraint or objective

Parameters
oraclepointer to NLPIORACLE data structure
considxindex of constraint where expression tree should be changed, or -1 for objective
exprvaridxsproblem indices of variables in expression tree
exprtreenew expression tree, or NULL

Definition at line 2100 of file nlpioracle.c.

References BMSduplicateBlockMemoryArray, BMSfreeBlockMemoryArray, SCIP_NlpiOracleCons::exprtree, SCIP_NlpiOracleCons::exprvaridxs, FALSE, invalidateHessianLagSparsity(), invalidateJacobiSparsity(), NULL, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPexprintCompile(), SCIPexprtreeCopy(), SCIPexprtreeFree(), and SCIPexprtreeGetNVars().

Referenced by SCIP_DECL_NLPICHGEXPRTREE().

◆ SCIPnlpiOracleChgExprParam()

SCIP_RETCODE SCIPnlpiOracleChgExprParam ( SCIP_NLPIORACLE oracle,
int  considx,
int  paramidx,
SCIP_Real  paramval 
)

changes one parameter of expression tree of one constraint or objective

Parameters
oraclepointer to NLPIORACLE data structure
considxindex of constraint where parameter should be changed in expression tree, or -1 for objective
paramidxindex of parameter
paramvalnew value of parameter

Definition at line 2157 of file nlpioracle.c.

References NULL, SCIP_OKAY, SCIPdebugMessage, SCIPexprtreeGetNParams(), and SCIPexprtreeSetParamVal().

Referenced by SCIP_DECL_NLPICHGNONLINCOEF().

◆ SCIPnlpiOracleChgObjConstant()

SCIP_RETCODE SCIPnlpiOracleChgObjConstant ( SCIP_NLPIORACLE oracle,
SCIP_Real  objconstant 
)

changes the constant value in the objective function

Parameters
oraclepointer to NLPIORACLE data structure
objconstantnew value for objective constant

Definition at line 2182 of file nlpioracle.c.

References NULL, SCIP_OKAY, and SCIPdebugMessage.

Referenced by SCIP_DECL_NLPICHGOBJCONSTANT().

◆ SCIPnlpiOracleGetNVars()

◆ SCIPnlpiOracleGetNConstraints()

int SCIPnlpiOracleGetNConstraints ( SCIP_NLPIORACLE oracle)

gives the current number of constraints

Parameters
oraclepointer to NLPIORACLE data structure

Definition at line 2208 of file nlpioracle.c.

References SCIP_NlpiOracle::nconss, and NULL.

Referenced by computeInteriorPoint(), initWorhp(), processSolveOutcome(), SCIP_DECL_NLPIADDCONSTRAINTS(), SCIP_DECL_NLPIADDVARS(), SCIP_DECL_NLPISOLVE(), SCIPsetModifiedDefaultSettingsIpopt(), setupGradients(), setupStart(), updateWorhp(), userDF(), userDG(), userF(), userG(), and userHM().

◆ SCIPnlpiOracleGetVarLbs()

const SCIP_Real* SCIPnlpiOracleGetVarLbs ( SCIP_NLPIORACLE oracle)

gives the variables lower bounds

Parameters
oraclepointer to NLPIORACLE data structure

Definition at line 2218 of file nlpioracle.c.

References NULL, and SCIP_NlpiOracle::varlbs.

Referenced by initWorhp(), SCIP_DECL_NLPICHGVARBOUNDS(), SCIP_DECL_NLPISOLVE(), SCIPsetModifiedDefaultSettingsIpopt(), setupStart(), and updateWorhp().

◆ SCIPnlpiOracleGetVarUbs()

const SCIP_Real* SCIPnlpiOracleGetVarUbs ( SCIP_NLPIORACLE oracle)

gives the variables upper bounds

Parameters
oraclepointer to NLPIORACLE data structure

Definition at line 2228 of file nlpioracle.c.

References NULL, and SCIP_NlpiOracle::varubs.

Referenced by initWorhp(), SCIP_DECL_NLPICHGVARBOUNDS(), SCIP_DECL_NLPISOLVE(), SCIPsetModifiedDefaultSettingsIpopt(), setupStart(), and updateWorhp().

◆ SCIPnlpiOracleGetVarNames()

char** SCIPnlpiOracleGetVarNames ( SCIP_NLPIORACLE oracle)

gives the variables names, or NULL if not set

Parameters
oraclepointer to NLPIORACLE data structure

Definition at line 2238 of file nlpioracle.c.

References NULL, and SCIP_NlpiOracle::varnames.

Referenced by SCIPsetModifiedDefaultSettingsIpopt().

◆ SCIPnlpiOracleGetVarDegree()

int SCIPnlpiOracleGetVarDegree ( SCIP_NLPIORACLE oracle,
int  varidx 
)

Gives maximum degree of a variable w.r.t. objective and all constraints. The degree of a variable is the degree of the summand where it appears in, and is infinity for nonpolynomial terms.

Parameters
oraclepointer to NLPIORACLE data structure
varidxindex of variable which degree should be returned

Definition at line 2250 of file nlpioracle.c.

References NULL, updateVariableDegrees(), and SCIP_NlpiOracle::vardegrees.

Referenced by SCIPsetModifiedDefaultSettingsIpopt().

◆ SCIPnlpiOracleGetVarDegrees()

int* SCIPnlpiOracleGetVarDegrees ( SCIP_NLPIORACLE oracle)

Gives maximum degree of all variables w.r.t. objective and all constraints. The degree of a variable is the degree of the summand where it appears in, and is infinity for nonpolynomial terms.

Parameters
oraclepointer to NLPIORACLE data structure

Definition at line 2267 of file nlpioracle.c.

References NULL, updateVariableDegrees(), and SCIP_NlpiOracle::vardegrees.

◆ SCIPnlpiOracleGetConstraintLhs()

SCIP_Real SCIPnlpiOracleGetConstraintLhs ( SCIP_NLPIORACLE oracle,
int  considx 
)

gives left-hand side of a constraint

Parameters
oraclepointer to NLPIORACLE data structure
considxconstraint index

Definition at line 2279 of file nlpioracle.c.

References SCIP_NlpiOracle::conss, SCIP_NlpiOracleCons::lhs, and NULL.

Referenced by initWorhp(), SCIP_DECL_NLPICHGCONSSIDES(), SCIP_DECL_NLPISOLVE(), SCIPsetModifiedDefaultSettingsIpopt(), and updateWorhp().

◆ SCIPnlpiOracleGetConstraintRhs()

SCIP_Real SCIPnlpiOracleGetConstraintRhs ( SCIP_NLPIORACLE oracle,
int  considx 
)

gives right-hand side of a constraint

Parameters
oraclepointer to NLPIORACLE data structure
considxconstraint index

Definition at line 2292 of file nlpioracle.c.

References SCIP_NlpiOracle::conss, NULL, and SCIP_NlpiOracleCons::rhs.

Referenced by initWorhp(), SCIP_DECL_NLPICHGCONSSIDES(), SCIP_DECL_NLPISOLVE(), SCIPsetModifiedDefaultSettingsIpopt(), and updateWorhp().

◆ SCIPnlpiOracleGetConstraintName()

char* SCIPnlpiOracleGetConstraintName ( SCIP_NLPIORACLE oracle,
int  considx 
)

gives name of a constraint, may be NULL

Parameters
oraclepointer to NLPIORACLE data structure
considxconstraint index

Definition at line 2305 of file nlpioracle.c.

References SCIP_NlpiOracle::conss, SCIP_NlpiOracleCons::name, and NULL.

Referenced by SCIPsetModifiedDefaultSettingsIpopt().

◆ SCIPnlpiOracleGetConstraintDegree()

int SCIPnlpiOracleGetConstraintDegree ( SCIP_NLPIORACLE oracle,
int  considx 
)

gives maximum degree of a constraint or objective The degree is the maximal degree of all summands,, and is infinity for nonpolynomial terms.

Parameters
oraclepointer to NLPIORACLE data structure
considxindex of constraint for which the degree is requested, or -1 for objective

Definition at line 2320 of file nlpioracle.c.

References SCIP_NlpiOracle::conss, SCIP_NlpiOracleCons::exprtree, SCIP_NlpiOracleCons::nlinidxs, SCIP_NlpiOracleCons::nquadelems, NULL, and SCIP_NlpiOracle::objective.

Referenced by computeInteriorPoint(), SCIP_DECL_NLPIADDCONSTRAINTS(), SCIP_DECL_NLPICHGEXPRTREE(), SCIP_DECL_NLPICHGQUADCOEFS(), SCIP_DECL_NLPISETOBJECTIVE(), SCIP_DECL_NLPISOLVE(), and SCIPsetModifiedDefaultSettingsIpopt().

◆ SCIPnlpiOracleGetMaxDegree()

int SCIPnlpiOracleGetMaxDegree ( SCIP_NLPIORACLE oracle)

Gives maximum degree over all constraints and the objective (or over all variables, resp.). Thus, if this function returns 0, then the objective and all constraints are constant. If it returns 1, then the problem in linear. If it returns 2, then its a QP, QCP, or QCQP. And if it returns > 2, then it is an NLP.

Parameters
oraclepointer to NLPIORACLE data structure

Definition at line 2352 of file nlpioracle.c.

References NULL, SCIPdebugMessage, and updateVariableDegrees().

Referenced by SCIP_DECL_NLPISOLVE().

◆ SCIPnlpiOracleGetEvalCapability()

SCIP_EXPRINTCAPABILITY SCIPnlpiOracleGetEvalCapability ( SCIP_NLPIORACLE oracle)

Gives the evaluation capabilities that are shared among all expression trees in the problem.

Parameters
oraclepointer to NLPIORACLE data structure

Definition at line 2378 of file nlpioracle.c.

References SCIP_NlpiOracle::conss, SCIP_NlpiOracle::exprinterpreter, SCIP_NlpiOracleCons::exprtree, SCIP_NlpiOracle::nconss, NULL, SCIP_NlpiOracle::objective, SCIP_EXPRINTCAPABILITY_ALL, and SCIPexprintGetExprtreeCapability().

Referenced by SCIP_DECL_NLPISOLVE().

◆ SCIPnlpiOracleEvalObjectiveValue()

SCIP_RETCODE SCIPnlpiOracleEvalObjectiveValue ( SCIP_NLPIORACLE oracle,
const SCIP_Real x,
SCIP_Real objval 
)

evaluates the objective function in a given point

Parameters
oraclepointer to NLPIORACLE data structure
xpoint where to evaluate
objvalpointer to store objective value

Definition at line 2400 of file nlpioracle.c.

References evalFunctionValue(), NULL, SCIP_CALL_QUIET, SCIP_OKAY, and SCIPdebugMessage.

Referenced by F77_FUNC(), SCIP_DECL_NLPIGETSOLUTION(), SCIPsetModifiedDefaultSettingsIpopt(), setupStart(), and userF().

◆ SCIPnlpiOracleEvalConstraintValue()

SCIP_RETCODE SCIPnlpiOracleEvalConstraintValue ( SCIP_NLPIORACLE oracle,
int  considx,
const SCIP_Real x,
SCIP_Real conval 
)

evaluates one constraint function in a given point

Parameters
oraclepointer to NLPIORACLE data structure
considxindex of constraint to evaluate
xpoint where to evaluate
convalpointer to store constraint value

Definition at line 2419 of file nlpioracle.c.

References evalFunctionValue(), NULL, SCIP_NlpiOracle::nvars, SCIP_CALL_QUIET, SCIP_OKAY, and SCIPdebugMessage.

Referenced by F77_FUNC(), and setupStart().

◆ SCIPnlpiOracleEvalConstraintValues()

SCIP_RETCODE SCIPnlpiOracleEvalConstraintValues ( SCIP_NLPIORACLE oracle,
const SCIP_Real x,
SCIP_Real convals 
)

evaluates all constraint functions in a given point

Parameters
oraclepointer to NLPIORACLE data structure
xpoint where to evaluate
convalsbuffer to store constraint values

Definition at line 2438 of file nlpioracle.c.

References evalFunctionValue(), NULL, SCIP_CALL_QUIET, SCIP_OKAY, and SCIPdebugMessage.

Referenced by SCIPsetModifiedDefaultSettingsIpopt(), and userG().

◆ SCIPnlpiOracleEvalObjectiveGradient()

SCIP_RETCODE SCIPnlpiOracleEvalObjectiveGradient ( SCIP_NLPIORACLE oracle,
const SCIP_Real x,
SCIP_Bool  isnewx,
SCIP_Real objval,
SCIP_Real objgrad 
)

computes the objective gradient in a given point

Returns
SCIP_INVALIDDATA, if the function or its gradient could not be evaluated (domain error, etc.)
Parameters
oraclepointer to NLPIORACLE data structure
xpoint where to evaluate
isnewxhas the point x changed since the last call to some evaluation function?
objvalpointer to store objective value
objgradpointer to store (dense) objective gradient

Definition at line 2464 of file nlpioracle.c.

References evalFunctionGradient(), NULL, SCIP_CALL_QUIET, SCIP_OKAY, and SCIPdebugMessage.

Referenced by F77_FUNC(), SCIPsetModifiedDefaultSettingsIpopt(), setupStart(), and userDF().

◆ SCIPnlpiOracleEvalConstraintGradient()

SCIP_RETCODE SCIPnlpiOracleEvalConstraintGradient ( SCIP_NLPIORACLE oracle,
const int  considx,
const SCIP_Real x,
SCIP_Bool  isnewx,
SCIP_Real conval,
SCIP_Real congrad 
)

computes a constraints gradient in a given point

Returns
SCIP_INVALIDDATA, if the function or its gradient could not be evaluated (domain error, etc.)
Parameters
oraclepointer to NLPIORACLE data structure
considxindex of constraint to compute gradient for
xpoint where to evaluate
isnewxhas the point x changed since the last call to some evaluation function?
convalpointer to store constraint value
congradpointer to store (dense) constraint gradient

Definition at line 2488 of file nlpioracle.c.

References evalFunctionGradient(), NULL, SCIP_NlpiOracle::nvars, SCIP_CALL_QUIET, SCIP_OKAY, and SCIPdebugMessage.

Referenced by SCIPnlpiOracleEvalJacobian().

◆ SCIPnlpiOracleGetJacobianSparsity()

SCIP_RETCODE SCIPnlpiOracleGetJacobianSparsity ( SCIP_NLPIORACLE oracle,
const int **  offset,
const int **  col 
)

gets sparsity pattern (rowwise) of Jacobian matrix

Note that internal data is returned in *offset and *col, thus the user does not need to allocate memory there. Adding or deleting constraints destroys the sparsity structure and make another call to this function necessary.

Parameters
oraclepointer to NLPIORACLE data structure
offsetpointer to store pointer that stores the offsets to each rows sparsity pattern in col, can be NULL
colpointer to store pointer that stores the indices of variables that appear in each row, offset[nconss] gives length of col, can be NULL

Definition at line 2513 of file nlpioracle.c.

References BMSallocBlockMemoryArray, BMSclearMemoryArray, BMScopyMemoryArray, BMSfreeBlockMemoryArray, BMSreallocBlockMemoryArray, ensureIntArraySize(), SCIP_NlpiOracleCons::exprtree, SCIP_NlpiOracleCons::exprvaridxs, FALSE, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_NlpiOracleCons::linidxs, SCIP_NlpiOracleCons::nlinidxs, SCIP_NlpiOracleCons::nquadelems, NULL, SCIP_NlpiOracleCons::quadelems, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPexprtreeGetNVars(), and TRUE.

Referenced by initWorhp(), SCIPsetModifiedDefaultSettingsIpopt(), and setupGradients().

◆ SCIPnlpiOracleEvalJacobian()

SCIP_RETCODE SCIPnlpiOracleEvalJacobian ( SCIP_NLPIORACLE oracle,
const SCIP_Real x,
SCIP_Bool  isnewx,
SCIP_Real convals,
SCIP_Real jacobi 
)

evaluates the Jacobi matrix in a given point

The values in the Jacobi matrix are returned in the same order as specified by the offset and col arrays obtained by SCIPnlpiOracleGetJacobianSparsity. The user need to call SCIPnlpiOracleGetJacobianSparsity at least ones before using this function.

Returns
SCIP_INVALIDDATA, if the Jacobian could not be evaluated (domain error, etc.)
Parameters
oraclepointer to NLPIORACLE data structure
xpoint where to evaluate
isnewxhas the point x changed since the last call to some evaluation function?
convalspointer to store constraint values, can be NULL
jacobipointer to store sparse jacobian values

Definition at line 2654 of file nlpioracle.c.

References BMSallocBlockMemoryArray, BMScopyMemoryArray, BMSfreeBlockMemoryArray, BMSfreeBlockMemoryArrayNull, SCIP_NlpiOracleCons::exprtree, SCIP_NlpiOracleCons::exprvaridxs, SCIP_NlpiOracleCons::lincoefs, SCIP_NlpiOracleCons::nlinidxs, SCIP_NlpiOracleCons::nquadelems, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPdebug, SCIPdebugMessage, SCIPexprintEval(), SCIPexprintGrad(), SCIPexprtreeGetNVars(), SCIPisFinite, and SCIPnlpiOracleEvalConstraintGradient().

Referenced by F77_FUNC(), SCIPsetModifiedDefaultSettingsIpopt(), setupStart(), and userDG().

◆ SCIPnlpiOracleGetHessianLagSparsity()

SCIP_RETCODE SCIPnlpiOracleGetHessianLagSparsity ( SCIP_NLPIORACLE oracle,
const int **  offset,
const int **  col 
)

gets sparsity pattern of the Hessian matrix of the Lagrangian

Note that internal data is returned in *offset and *col, thus the user must not allocate memory there. Adding or deleting variables, objective, or constraints may destroy the sparsity structure and make another call to this function necessary. Only elements of the lower left triangle and the diagonal are counted.

Parameters
oraclepointer to NLPIORACLE data structure
offsetpointer to store pointer that stores the offsets to each rows sparsity pattern in col, can be NULL
colpointer to store pointer that stores the indices of variables that appear in each row, offset[nconss] gives length of col, can be NULL

Definition at line 2793 of file nlpioracle.c.

References BMSallocBlockMemoryArray, BMSclearMemoryArray, BMSfreeBlockMemoryArray, BMSfreeBlockMemoryArrayNull, hessLagSparsitySetNzFlagForExprtree(), hessLagSparsitySetNzFlagForQuad(), NULL, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, and SCIPdebugMessage.

Referenced by initWorhp(), SCIPsetModifiedDefaultSettingsIpopt(), setupHessian(), and userHM().

◆ SCIPnlpiOracleEvalHessianLag()

SCIP_RETCODE SCIPnlpiOracleEvalHessianLag ( SCIP_NLPIORACLE oracle,
const SCIP_Real x,
SCIP_Bool  isnewx,
SCIP_Real  objfactor,
const SCIP_Real lambda,
SCIP_Real hessian 
)

evaluates the Hessian matrix of the Lagrangian in a given point

The values in the Hessian matrix are returned in the same order as specified by the offset and col arrays obtained by SCIPnlpiOracleGetHessianLagSparsity. The user must call SCIPnlpiOracleGetHessianLagSparsity at least ones before using this function. Only elements of the lower left triangle and the diagonal are computed.

Returns
SCIP_INVALIDDATA, if the Hessian could not be evaluated (domain error, etc.)
Parameters
oraclepointer to NLPIORACLE data structure
xpoint where to evaluate
isnewxhas the point x changed since the last call to some evaluation function?
objfactorweight for objective function
lambdaweights (Lagrangian multipliers) for the constraints
hessianpointer to store sparse hessian values

Definition at line 2892 of file nlpioracle.c.

References SCIP_NlpiOracle::heslagcols, SCIP_NlpiOracle::heslagoffsets, hessLagAddExprtree(), hessLagAddQuad(), SCIP_NlpiOracle::nconss, NULL, SCIP_CALL, SCIP_CALL_QUIET, SCIP_OKAY, and SCIPdebugMessage.

Referenced by F77_FUNC(), SCIPsetModifiedDefaultSettingsIpopt(), and userHM().

◆ SCIPnlpiOraclePrintProblem()

SCIP_RETCODE SCIPnlpiOraclePrintProblem ( SCIP_NLPIORACLE oracle,
SCIP_MESSAGEHDLR messagehdlr,
FILE *  file 
)

prints the problem to a file.

Parameters
oraclepointer to NLPIORACLE data structure
messagehdlrmessage handler
filefile to print to, or NULL for standard output

Definition at line 2935 of file nlpioracle.c.

References FALSE, infinity, SCIP_NlpiOracleCons::lhs, NULL, printFunction(), SCIP_NlpiOracleCons::rhs, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, and SCIPmessageFPrintInfo().

Referenced by computeInteriorPoint(), and SCIP_DECL_NLPISOLVE().

◆ SCIPnlpiOraclePrintProblemGams()

SCIP_RETCODE SCIPnlpiOraclePrintProblemGams ( SCIP_NLPIORACLE oracle,
SCIP_Real initval,
SCIP_MESSAGEHDLR messagehdlr,
FILE *  file 
)

prints the problem to a file in GAMS format If there are variable (equation, resp.) names with more than 9 characters, then variable (equation, resp.) names are prefixed with an unique identifier. This is to make it easier to identify variables solution output in the listing file. Names with more than 64 characters are shorten to 64 letters due to GAMS limits.

Parameters
oraclepointer to NLPIORACLE data structure
initvalstarting point values for variables or NULL
messagehdlrmessage handler
filefile to print to, or NULL for standard output

Definition at line 3004 of file nlpioracle.c.

References exprIsNonSmooth(), SCIP_NlpiOracleCons::exprtree, FALSE, infinity, SCIP_NlpiOracleCons::lhs, SCIP_NlpiOracleCons::name, SCIP_NlpiOracleCons::nquadelems, NULL, printFunction(), printName(), SCIP_NlpiOracleCons::rhs, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPexprtreeGetRoot(), SCIPmessageFPrintInfo(), SCIPsnprintf(), and TRUE.