Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

implementation of NLPI oracle

Author
Stefan Vigerske

Definition in file nlpioracle.c.

#include "scip/scip.h"
#include "scip/nlpioracle.h"
#include "scip/exprinterpret.h"
#include "scip/expr_pow.h"
#include "scip/expr_varidx.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 SCIP_RETCODE ensureVarsSize (SCIP *scip, SCIP_NLPIORACLE *oracle, int minsize)
 
static SCIP_RETCODE ensureConssSize (SCIP *scip, SCIP_NLPIORACLE *oracle, int minsize)
 
static SCIP_RETCODE ensureConsLinSize (SCIP *scip, SCIP_NLPIORACLECONS *cons, int minsize)
 
static SCIP_RETCODE ensureIntArraySize (SCIP *scip, int **intarray, int *len, int minsize)
 
static void invalidateJacobiSparsity (SCIP *scip, SCIP_NLPIORACLE *oracle)
 
static void invalidateHessianLagSparsity (SCIP *scip, SCIP_NLPIORACLE *oracle)
 
static SCIP_RETCODE updateVariableCounts (SCIP *scip, SCIP_NLPIORACLE *oracle, int factor, int nlinidxs, const int *linidxs, SCIP_EXPR *expr)
 
static void sortLinearCoefficients (int *nidxs, int *idxs, SCIP_Real *coefs)
 
static SCIP_RETCODE createConstraint (SCIP *scip, SCIP_NLPIORACLE *oracle, SCIP_NLPIORACLECONS **cons, int nlinidxs, const int *linidxs, const SCIP_Real *lincoefs, SCIP_EXPR *expr, SCIP_Real lhs, SCIP_Real rhs, const char *name)
 
static SCIP_RETCODE freeConstraint (SCIP *scip, SCIP_NLPIORACLE *oracle, SCIP_NLPIORACLECONS **cons, SCIP_Bool updatevarcount)
 
static SCIP_RETCODE freeConstraints (SCIP *scip, SCIP_NLPIORACLE *oracle)
 
static SCIP_RETCODE moveVariable (SCIP *scip, SCIP_NLPIORACLE *oracle, int fromidx, int toidx)
 
static void freeVariables (SCIP *scip, SCIP_NLPIORACLE *oracle)
 
static void mapIndices (int *indexmap, int nindices, int *indices)
 
static void clearDeletedLinearElements (int **linidxs, SCIP_Real **coefs, int *nidxs)
 
static SCIP_RETCODE evalFunctionValue (SCIP *scip, SCIP_NLPIORACLE *oracle, SCIP_NLPIORACLECONS *cons, const SCIP_Real *x, SCIP_Real *val)
 
static SCIP_RETCODE evalFunctionGradient (SCIP *scip, SCIP_NLPIORACLE *oracle, SCIP_NLPIORACLECONS *cons, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real *RESTRICT val, SCIP_Real *RESTRICT grad)
 
static SCIP_RETCODE hessLagSparsitySetNzFlagForExpr (SCIP *scip, SCIP_NLPIORACLE *oracle, int **colnz, int *collen, int *colnnz, int *nzcount, SCIP_EXPR *expr, SCIP_EXPRINTDATA *exprintdata, int dim)
 
static SCIP_RETCODE hessLagAddExpr (SCIP *scip, SCIP_NLPIORACLE *oracle, SCIP_Real weight, const SCIP_Real *x, SCIP_Bool new_x, SCIP_EXPR *expr, SCIP_EXPRINTDATA *exprintdata, 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 *scip, SCIP_NLPIORACLE *oracle, FILE *file, SCIP_NLPIORACLECONS *cons, SCIP_Bool longvarnames)
 
static SCIP_RETCODE exprIsNonSmooth (SCIP *scip, SCIP_EXPR *expr, SCIP_Bool *nonsmooth)
 
public function
SCIP_RETCODE SCIPnlpiOracleCreate (SCIP *scip, SCIP_NLPIORACLE **oracle)
 
SCIP_RETCODE SCIPnlpiOracleFree (SCIP *scip, SCIP_NLPIORACLE **oracle)
 
SCIP_RETCODE SCIPnlpiOracleSetProblemName (SCIP *scip, SCIP_NLPIORACLE *oracle, const char *name)
 
const char * SCIPnlpiOracleGetProblemName (SCIP_NLPIORACLE *oracle)
 
SCIP_RETCODE SCIPnlpiOracleAddVars (SCIP *scip, SCIP_NLPIORACLE *oracle, int nvars, const SCIP_Real *lbs, const SCIP_Real *ubs, const char **varnames)
 
SCIP_RETCODE SCIPnlpiOracleAddConstraints (SCIP *scip, SCIP_NLPIORACLE *oracle, 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 **consnames)
 
SCIP_RETCODE SCIPnlpiOracleSetObjective (SCIP *scip, SCIP_NLPIORACLE *oracle, const SCIP_Real constant, int nlin, const int *lininds, const SCIP_Real *linvals, SCIP_EXPR *expr)
 
SCIP_RETCODE SCIPnlpiOracleChgVarBounds (SCIP *scip, SCIP_NLPIORACLE *oracle, int nvars, const int *indices, const SCIP_Real *lbs, const SCIP_Real *ubs)
 
SCIP_RETCODE SCIPnlpiOracleChgConsSides (SCIP *scip, SCIP_NLPIORACLE *oracle, int nconss, const int *indices, const SCIP_Real *lhss, const SCIP_Real *rhss)
 
SCIP_RETCODE SCIPnlpiOracleDelVarSet (SCIP *scip, SCIP_NLPIORACLE *oracle, int *delstats)
 
SCIP_RETCODE SCIPnlpiOracleDelConsSet (SCIP *scip, SCIP_NLPIORACLE *oracle, int *delstats)
 
SCIP_RETCODE SCIPnlpiOracleChgLinearCoefs (SCIP *scip, SCIP_NLPIORACLE *oracle, int considx, int nentries, const int *varidxs, const SCIP_Real *newcoefs)
 
SCIP_RETCODE SCIPnlpiOracleChgExpr (SCIP *scip, SCIP_NLPIORACLE *oracle, int considx, SCIP_EXPR *expr)
 
SCIP_RETCODE SCIPnlpiOracleChgObjConstant (SCIP *scip, 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)
 
SCIP_Bool SCIPnlpiOracleIsVarNonlinear (SCIP *scip, SCIP_NLPIORACLE *oracle, int varidx)
 
void SCIPnlpiOracleGetVarCounts (SCIP *scip, SCIP_NLPIORACLE *oracle, const int **lincounts, const int **nlcounts)
 
SCIP_Real SCIPnlpiOracleGetObjectiveConstant (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)
 
SCIP_Bool SCIPnlpiOracleIsConstraintNonlinear (SCIP_NLPIORACLE *oracle, int considx)
 
SCIP_EXPRINTCAPABILITY SCIPnlpiOracleGetEvalCapability (SCIP *scip, SCIP_NLPIORACLE *oracle)
 
SCIP_RETCODE SCIPnlpiOracleEvalObjectiveValue (SCIP *scip, SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Real *objval)
 
SCIP_RETCODE SCIPnlpiOracleEvalConstraintValue (SCIP *scip, SCIP_NLPIORACLE *oracle, int considx, const SCIP_Real *x, SCIP_Real *conval)
 
SCIP_RETCODE SCIPnlpiOracleEvalConstraintValues (SCIP *scip, SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Real *convals)
 
SCIP_RETCODE SCIPnlpiOracleEvalObjectiveGradient (SCIP *scip, SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real *objval, SCIP_Real *objgrad)
 
SCIP_RETCODE SCIPnlpiOracleEvalConstraintGradient (SCIP *scip, SCIP_NLPIORACLE *oracle, const int considx, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real *conval, SCIP_Real *congrad)
 
SCIP_RETCODE SCIPnlpiOracleGetJacobianSparsity (SCIP *scip, SCIP_NLPIORACLE *oracle, const int **offset, const int **col)
 
SCIP_RETCODE SCIPnlpiOracleEvalJacobian (SCIP *scip, SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real *convals, SCIP_Real *jacobi)
 
SCIP_RETCODE SCIPnlpiOracleGetHessianLagSparsity (SCIP *scip, SCIP_NLPIORACLE *oracle, const int **offset, const int **col)
 
SCIP_RETCODE SCIPnlpiOracleEvalHessianLag (SCIP *scip, SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Bool isnewx_obj, SCIP_Bool isnewx_cons, SCIP_Real objfactor, const SCIP_Real *lambda, SCIP_Real *hessian)
 
SCIP_RETCODE SCIPnlpiOracleResetEvalTime (SCIP *scip, SCIP_NLPIORACLE *oracle)
 
SCIP_Real SCIPnlpiOracleGetEvalTime (SCIP *scip, SCIP_NLPIORACLE *oracle)
 
SCIP_RETCODE SCIPnlpiOraclePrintProblem (SCIP *scip, SCIP_NLPIORACLE *oracle, FILE *file)
 
SCIP_RETCODE SCIPnlpiOraclePrintProblemGams (SCIP *scip, SCIP_NLPIORACLE *oracle, SCIP_Real *initval, FILE *file)
 

Typedef Documentation

◆ SCIP_NLPIORACLECONS

Definition at line 61 of file nlpioracle.c.

Function Documentation

◆ ensureVarsSize()

static SCIP_RETCODE ensureVarsSize ( SCIP scip,
SCIP_NLPIORACLE oracle,
int  minsize 
)
static

ensures that those arrays in oracle that store information on variables have at least a given length

Parameters
scipSCIP data structure
oracleNLPIORACLE data structure
minsizeminimal required size

Definition at line 102 of file nlpioracle.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), SCIPreallocBlockMemoryArray, SCIP_NlpiOracle::varlbs, SCIP_NlpiOracle::varlincount, SCIP_NlpiOracle::varnames, SCIP_NlpiOracle::varnlcount, SCIP_NlpiOracle::varssize, and SCIP_NlpiOracle::varubs.

Referenced by SCIPnlpiOracleAddVars().

◆ ensureConssSize()

static SCIP_RETCODE ensureConssSize ( SCIP scip,
SCIP_NLPIORACLE oracle,
int  minsize 
)
static

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

Parameters
scipSCIP data structure
oracleNLPIORACLE data structure
minsizeminimal required size

Definition at line 135 of file nlpioracle.c.

References SCIP_NlpiOracle::conss, SCIP_NlpiOracle::consssize, NULL, SCIP_CALL, SCIP_OKAY, and SCIPensureBlockMemoryArray.

Referenced by SCIPnlpiOracleAddConstraints().

◆ ensureConsLinSize()

static SCIP_RETCODE ensureConsLinSize ( SCIP scip,
SCIP_NLPIORACLECONS cons,
int  minsize 
)
static

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

Parameters
scipSCIP data structure
consoracle constraint
minsizeminimal required size

Definition at line 151 of file nlpioracle.c.

References SCIP_NlpiOracleCons::lincoefs, SCIP_NlpiOracleCons::linidxs, SCIP_NlpiOracleCons::linsize, NULL, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), and SCIPreallocBlockMemoryArray.

Referenced by SCIPnlpiOracleChgLinearCoefs().

◆ ensureIntArraySize()

static SCIP_RETCODE ensureIntArraySize ( SCIP scip,
int **  intarray,
int *  len,
int  minsize 
)
static

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

Parameters
scipSCIP data structure
intarrayarray of integers
lenlength of array (modified if reallocated)
minsizeminimal required array length

Definition at line 177 of file nlpioracle.c.

References NULL, SCIP_CALL, SCIP_OKAY, and SCIPensureBlockMemoryArray.

Referenced by hessLagSparsitySetNzFlagForExpr(), and SCIPnlpiOracleGetJacobianSparsity().

◆ invalidateJacobiSparsity()

static void invalidateJacobiSparsity ( SCIP scip,
SCIP_NLPIORACLE oracle 
)
static

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

Parameters
scipSCIP data structure
oraclepointer to store NLPIORACLE data structure

Definition at line 197 of file nlpioracle.c.

References NULL, SCIPdebugMessage, and SCIPfreeBlockMemoryArray.

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

◆ invalidateHessianLagSparsity()

static void invalidateHessianLagSparsity ( SCIP scip,
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
scipSCIP data structure
oraclepointer to store NLPIORACLE data structure

Definition at line 221 of file nlpioracle.c.

References NULL, SCIPdebugMessage, and SCIPfreeBlockMemoryArray.

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

◆ updateVariableCounts()

static SCIP_RETCODE updateVariableCounts ( SCIP scip,
SCIP_NLPIORACLE oracle,
int  factor,
int  nlinidxs,
const int *  linidxs,
SCIP_EXPR expr 
)
static

increases or decreases variable counts in oracle w.r.t. linear and nonlinear appearance

Parameters
scipSCIP data structure
oracleoracle data structure
factorwhether to add (factor=1) or remove (factor=-1) variable counts
nlinidxsnumber of linear indices
linidxsindices of variables in linear part
exprexpression

Definition at line 243 of file nlpioracle.c.

References FALSE, SCIP_NlpiOracleCons::nlinidxs, NULL, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_OKAY, SCIPcreateExpriter(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPfreeExpriter(), SCIPgetIndexExprVaridx(), SCIPisExprVaridx(), SCIP_NlpiOracle::varlincount, and SCIP_NlpiOracle::varnlcount.

Referenced by createConstraint(), freeConstraint(), SCIPnlpiOracleChgExpr(), SCIPnlpiOracleChgLinearCoefs(), and SCIPnlpiOracleDelConsSet().

◆ 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 288 of file nlpioracle.c.

References NULL, and SCIPsortIntReal().

Referenced by createConstraint(), and SCIPnlpiOracleChgLinearCoefs().

◆ createConstraint()

static SCIP_RETCODE createConstraint ( SCIP scip,
SCIP_NLPIORACLE oracle,
SCIP_NLPIORACLECONS **  cons,
int  nlinidxs,
const int *  linidxs,
const SCIP_Real lincoefs,
SCIP_EXPR expr,
SCIP_Real  lhs,
SCIP_Real  rhs,
const char *  name 
)
static

creates a NLPI constraint from given constraint data

Parameters
scipSCIP data structure
oraclepointer to NLPIORACLE data structure
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
exprexpression, or NULL
lhsleft-hand-side of constraint
rhsright-hand-side of constraint
namename of constraint, or NULL

Definition at line 337 of file nlpioracle.c.

References EPSEQ, EPSLE, SCIP_NlpiOracleCons::expr, SCIP_NlpiOracle::exprinterpreter, SCIP_NlpiOracleCons::lhs, SCIP_NlpiOracleCons::nlinidxs, NULL, SCIP_NlpiOracleCons::rhs, SCIP_CALL, SCIP_DEFAULT_EPSILON, SCIP_OKAY, SCIPallocClearBlockMemory, SCIPcaptureExpr(), SCIPduplicateBlockMemoryArray, SCIPexprintCompile(), sortLinearCoefficients(), and updateVariableCounts().

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

◆ freeConstraint()

static SCIP_RETCODE freeConstraint ( SCIP scip,
SCIP_NLPIORACLE oracle,
SCIP_NLPIORACLECONS **  cons,
SCIP_Bool  updatevarcount 
)
static

frees a constraint

Parameters
scipSCIP data structure
oraclepointer to NLPIORACLE data structure
conspointer to constraint that should be freed
updatevarcountwhether the update variable counts (typically TRUE)

Definition at line 400 of file nlpioracle.c.

References SCIP_NlpiOracle::exprinterpreter, NULL, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPexprintFreeData(), SCIPfreeBlockMemory, SCIPfreeBlockMemoryArrayNull, SCIPreleaseExpr(), and updateVariableCounts().

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

◆ freeConstraints()

static SCIP_RETCODE freeConstraints ( SCIP scip,
SCIP_NLPIORACLE oracle 
)
static

frees all constraints

Attention
This omits updating the variable counts in the oracle.
Parameters
scipSCIP data structure
oraclepointer to NLPIORACLE data structure

Definition at line 444 of file nlpioracle.c.

References FALSE, freeConstraint(), NULL, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, and SCIPfreeBlockMemoryArrayNull.

Referenced by SCIPnlpiOracleDelConsSet(), and SCIPnlpiOracleFree().

◆ moveVariable()

static SCIP_RETCODE moveVariable ( SCIP scip,
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
scipSCIP data structure
oraclepointer to store NLPIORACLE data structure
fromidxindex of variable to move
toidxindex of place where to move variable to

Definition at line 473 of file nlpioracle.c.

References NULL, SCIP_OKAY, SCIPdebugMessage, and SCIPinfinity().

Referenced by SCIPnlpiOracleDelVarSet().

◆ freeVariables()

static void freeVariables ( SCIP scip,
SCIP_NLPIORACLE oracle 
)
static

frees all variables

Parameters
scipSCIP data structure
oraclepointer to store NLPIORACLE data structure

Definition at line 512 of file nlpioracle.c.

References NULL, SCIPdebugMessage, SCIPfreeBlockMemoryArray, and SCIPfreeBlockMemoryArrayNull.

Referenced by SCIPnlpiOracleDelVarSet(), and SCIPnlpiOracleFree().

◆ 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 546 of file nlpioracle.c.

References NULL.

Referenced by SCIPnlpiOracleDelVarSet().

◆ clearDeletedLinearElements()

static void clearDeletedLinearElements ( 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
linidxsvariable indices
coefsvariable coefficients
nidxsnumber of indices

Definition at line 566 of file nlpioracle.c.

References NULL, and SCIPdebugMessage.

Referenced by SCIPnlpiOracleDelVarSet().

◆ evalFunctionValue()

static SCIP_RETCODE evalFunctionValue ( SCIP scip,
SCIP_NLPIORACLE oracle,
SCIP_NLPIORACLECONS cons,
const SCIP_Real x,
SCIP_Real val 
)
static

computes the value of a function

Parameters
scipSCIP data structure
oraclepointer to NLPIORACLE data structure
consoracle constraint
xthe point where to evaluate
valpointer to store function value

Definition at line 604 of file nlpioracle.c.

References SCIP_NlpiOracleCons::expr, SCIP_NlpiOracleCons::exprintdata, SCIP_NlpiOracleCons::lincoefs, SCIP_NlpiOracleCons::linidxs, SCIP_NlpiOracleCons::nlinidxs, NULL, SCIP_NlpiOracle::nvars, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPexprintEval(), SCIPisFinite, and SCIPisInfinity().

Referenced by SCIPnlpiOracleEvalConstraintValue(), SCIPnlpiOracleEvalConstraintValues(), and SCIPnlpiOracleEvalObjectiveValue().

◆ evalFunctionGradient()

static SCIP_RETCODE evalFunctionGradient ( SCIP scip,
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
scipSCIP data structure
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 657 of file nlpioracle.c.

References BMSclearMemoryArray, SCIP_NlpiOracleCons::expr, SCIP_NlpiOracleCons::exprintdata, SCIP_NlpiOracleCons::lincoefs, SCIP_NlpiOracleCons::linidxs, SCIP_NlpiOracleCons::nlinidxs, NULL, SCIP_NlpiOracle::nvars, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPdebug, SCIPdebugMessage, SCIPdebugMsg, SCIPexprintGrad(), SCIPisFinite, and SCIPisInfinity().

Referenced by SCIPnlpiOracleEvalConstraintGradient(), and SCIPnlpiOracleEvalObjectiveGradient().

◆ hessLagSparsitySetNzFlagForExpr()

static SCIP_RETCODE hessLagSparsitySetNzFlagForExpr ( SCIP scip,
SCIP_NLPIORACLE oracle,
int **  colnz,
int *  collen,
int *  colnnz,
int *  nzcount,
SCIP_EXPR expr,
SCIP_EXPRINTDATA exprintdata,
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
scipSCIP data structure
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
exprexpression
exprintdataexpression interpreter data for expression
dimdimension of matrix

Definition at line 731 of file nlpioracle.c.

References ensureIntArraySize(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPdebugMessage, SCIPexprintHessianSparsity(), SCIPfreeBufferArray, SCIPsortedvecFindInt(), SCIPsortedvecInsertInt(), and x.

Referenced by SCIPnlpiOracleGetHessianLagSparsity().

◆ hessLagAddExpr()

static SCIP_RETCODE hessLagAddExpr ( SCIP scip,
SCIP_NLPIORACLE oracle,
SCIP_Real  weight,
const SCIP_Real x,
SCIP_Bool  new_x,
SCIP_EXPR expr,
SCIP_EXPRINTDATA exprintdata,
int *  hesoffset,
int *  hescol,
SCIP_Real values 
)
static

adds hessian of an expression into hessian structure

Parameters
scipSCIP data structure
oracleoracle
weightweight of quadratic part
xpoint for which hessian should be returned
new_xwhether point has been evaluated before
exprexpression
exprintdataexpression interpreter data for expression
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 791 of file nlpioracle.c.

References FALSE, h, NULL, SCIP_CALL, SCIP_ERROR, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPerrorMessage, SCIPexprintHessian(), 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 858 of file nlpioracle.c.

References NULL, and SCIPsnprintf().

Referenced by printFunction(), and SCIPnlpiOraclePrintProblemGams().

◆ printFunction()

static SCIP_RETCODE printFunction ( SCIP scip,
SCIP_NLPIORACLE oracle,
FILE *  file,
SCIP_NLPIORACLECONS cons,
SCIP_Bool  longvarnames 
)
static

prints a function

Parameters
scipSCIP data structure
oraclepointer to NLPIORACLE data structure
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 893 of file nlpioracle.c.

References SCIP_NlpiOracleCons::expr, SCIP_NlpiOracleCons::lincoefs, SCIP_NlpiOracleCons::linidxs, SCIP_NlpiOracleCons::nlinidxs, NULL, printName(), SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPinfoMessage(), and SCIPprintExpr().

Referenced by SCIPnlpiOraclePrintProblem(), and SCIPnlpiOraclePrintProblemGams().

◆ exprIsNonSmooth()

static SCIP_RETCODE exprIsNonSmooth ( SCIP scip,
SCIP_EXPR expr,
SCIP_Bool nonsmooth 
)
static

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

Parameters
scipSCIP data structure
exprexpression
nonsmoothbuffer to store whether expression seems nonsmooth

Definition at line 930 of file nlpioracle.c.

References FALSE, NULL, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_OKAY, SCIPcreateExpriter(), SCIPexprGetHdlr(), SCIPexprhdlrGetName(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPfreeExpriter(), SCIPisExprSignpower(), and TRUE.

Referenced by SCIPnlpiOraclePrintProblemGams().