Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

Worhp NLP interface.

Author
Benjamin Mueller
Renke Kuhlmann

Definition in file nlpi_worhp.c.

#include "scip/nlpi_worhp.h"
#include "scip/nlpioracle.h"
#include "scip/exprinterpret.h"
#include "scip/interrupt.h"
#include "scip/scip_nlpi.h"
#include "scip/scip_general.h"
#include "scip/scip_message.h"
#include "scip/scip_mem.h"
#include "scip/scip_numerics.h"
#include "scip/scip_randnumgen.h"
#include "scip/scip_solve.h"
#include "scip/pub_misc.h"
#include "scip/pub_message.h"
#include <stdio.h>
#include <stdlib.h>
#include "worhp/worhp.h"

Go to the source code of this file.

Data Structures

struct  SCIP_NlpiProblem
 

Macros

#define NLPI_DESC   "Worhp interface"
 
#define NLPI_PRIORITY_IP   0
 
#define NLPI_PRIORITY_SQP   -2000
 
#define DEFAULT_VERBLEVEL   0
 
#define DEFAULT_SCALEDKKT   TRUE
 
#define DEFAULT_RANDSEED   107
 
#define MAXPERTURB   0.01
 

Functions

static void invalidateSolution (SCIP *scip, SCIP_NLPIPROBLEM *problem)
 
static SCIP_RETCODE evaluateWorhpRun (SCIP *scip, SCIP_NLPIPROBLEM *problem)
 
static SCIP_RETCODE userF (SCIP *scip, SCIP_NLPIPROBLEM *problem)
 
static SCIP_RETCODE userG (SCIP *scip, SCIP_NLPIPROBLEM *problem)
 
static SCIP_RETCODE userDF (SCIP *scip, SCIP_NLPIPROBLEM *problem)
 
static SCIP_RETCODE userDG (SCIP *scip, SCIP_NLPIPROBLEM *problem)
 
static SCIP_RETCODE userHM (SCIP *scip, SCIP_NLPIPROBLEM *problem)
 
static void noprint (int mode, const char s[])
 
static SCIP_RETCODE initWorhp (SCIP *scip, SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
 
static SCIP_RETCODE updateWorhp (SCIP_NLPIPROBLEM *problem)
 
static SCIP_RETCODE freeWorhp (SCIP_NLPIPROBLEM *problem)
 
static SCIP_RETCODE handleNlpParam (SCIP *scip, SCIP_NLPI *nlpi, Params *par, const SCIP_NLPPARAM nlpparam)
 
static SCIP_DECL_NLPICOPY (nlpiCopyWorhp)
 
static SCIP_DECL_NLPIFREE (nlpiFreeWorhp)
 
static SCIP_DECL_NLPICREATEPROBLEM (nlpiCreateProblemWorhp)
 
static SCIP_DECL_NLPIFREEPROBLEM (nlpiFreeProblemWorhp)
 
static SCIP_DECL_NLPIADDVARS (nlpiAddVarsWorhp)
 
static SCIP_DECL_NLPIADDCONSTRAINTS (nlpiAddConstraintsWorhp)
 
static SCIP_DECL_NLPISETOBJECTIVE (nlpiSetObjectiveWorhp)
 
static SCIP_DECL_NLPICHGVARBOUNDS (nlpiChgVarBoundsWorhp)
 
static SCIP_DECL_NLPICHGCONSSIDES (nlpiChgConsSidesWorhp)
 
static SCIP_DECL_NLPIDELVARSET (nlpiDelVarSetWorhp)
 
static SCIP_DECL_NLPIDELCONSSET (nlpiDelConstraintSetWorhp)
 
static SCIP_DECL_NLPICHGLINEARCOEFS (nlpiChgLinearCoefsWorhp)
 
static SCIP_DECL_NLPICHGEXPR (nlpiChgExprWorhp)
 
static SCIP_DECL_NLPICHGOBJCONSTANT (nlpiChgObjConstantWorhp)
 
static SCIP_DECL_NLPISETINITIALGUESS (nlpiSetInitialGuessWorhp)
 
static SCIP_DECL_NLPISOLVE (nlpiSolveWorhp)
 
static SCIP_DECL_NLPIGETSOLSTAT (nlpiGetSolstatWorhp)
 
static SCIP_DECL_NLPIGETTERMSTAT (nlpiGetTermstatWorhp)
 
static SCIP_DECL_NLPIGETSOLUTION (nlpiGetSolutionWorhp)
 
static SCIP_DECL_NLPIGETSTATISTICS (nlpiGetStatisticsWorhp)
 
SCIP_RETCODE SCIPincludeNlpSolverWorhp (SCIP *scip, SCIP_Bool useip)
 
const char * SCIPgetSolverNameWorhp (void)
 
const char * SCIPgetSolverDescWorhp (void)
 
SCIP_Bool SCIPisWorhpAvailableWorhp (void)
 

Macro Definition Documentation

◆ NLPI_DESC

#define NLPI_DESC   "Worhp interface"

description of solver

Definition at line 60 of file nlpi_worhp.c.

Referenced by SCIPincludeNlpSolverWorhp().

◆ NLPI_PRIORITY_IP

#define NLPI_PRIORITY_IP   0

priority of NLP solver (Interior Point)

Definition at line 61 of file nlpi_worhp.c.

Referenced by SCIPincludeNlpSolverWorhp().

◆ NLPI_PRIORITY_SQP

#define NLPI_PRIORITY_SQP   -2000

priority of NLP solver (SQP)

Definition at line 62 of file nlpi_worhp.c.

Referenced by SCIPincludeNlpSolverWorhp().

◆ DEFAULT_VERBLEVEL

#define DEFAULT_VERBLEVEL   0

default verbosity level (0: normal 1: full 2: debug >2: more debug)

Definition at line 64 of file nlpi_worhp.c.

◆ DEFAULT_SCALEDKKT

#define DEFAULT_SCALEDKKT   TRUE

default whether KKT conditions are allowed to be scaled in the solver

Definition at line 65 of file nlpi_worhp.c.

Referenced by handleNlpParam().

◆ DEFAULT_RANDSEED

#define DEFAULT_RANDSEED   107

initial random seed

Definition at line 66 of file nlpi_worhp.c.

Referenced by SCIP_DECL_NLPICREATEPROBLEM().

◆ MAXPERTURB

#define MAXPERTURB   0.01

maximal perturbation of bounds in starting point heuristic

Definition at line 68 of file nlpi_worhp.c.

Referenced by SCIP_DECL_NLPISOLVE().

Function Documentation

◆ invalidateSolution()

◆ evaluateWorhpRun()

◆ userF()

static SCIP_RETCODE userF ( SCIP scip,
SCIP_NLPIPROBLEM problem 
)
static

evaluates objective function and store the result in the corresponding Worhp data fields

Parameters
scipSCIP data structure
problempointer to problem data structure

Definition at line 424 of file nlpi_worhp.c.

References NULL, SCIP_NlpiProblem::opt, SCIP_NlpiProblem::oracle, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPnlpiOracleEvalObjectiveValue(), SCIPnlpiOracleGetNConstraints(), SCIPnlpiOracleGetNVars(), and SCIP_NlpiProblem::wsp.

Referenced by SCIP_DECL_NLPISOLVE().

◆ userG()

static SCIP_RETCODE userG ( SCIP scip,
SCIP_NLPIPROBLEM problem 
)
static

evaluates constraints and store the result in the corresponding Worhp data fields

Parameters
scipSCIP data structure
problempointer to problem data structure

Definition at line 457 of file nlpi_worhp.c.

References NULL, SCIP_NlpiProblem::opt, SCIP_NlpiProblem::oracle, SCIP_CALL, SCIP_OKAY, SCIPnlpiOracleEvalConstraintValues(), SCIPnlpiOracleGetNConstraints(), SCIPnlpiOracleGetNVars(), and SCIP_NlpiProblem::wsp.

Referenced by SCIP_DECL_NLPISOLVE().

◆ userDF()

static SCIP_RETCODE userDF ( SCIP scip,
SCIP_NLPIPROBLEM problem 
)
static

computes objective gradient and store the result in the corresponding Worhp data fields

Parameters
scipSCIP data structure
problempointer to problem data structure

Definition at line 489 of file nlpi_worhp.c.

References NULL, SCIP_NlpiProblem::opt, SCIP_NlpiProblem::oracle, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPnlpiOracleEvalObjectiveGradient(), SCIPnlpiOracleGetNConstraints(), SCIPnlpiOracleGetNVars(), TRUE, and SCIP_NlpiProblem::wsp.

Referenced by SCIP_DECL_NLPISOLVE().

◆ userDG()

static SCIP_RETCODE userDG ( SCIP scip,
SCIP_NLPIPROBLEM problem 
)
static

computes jacobian matrix and store the result in the corresponding Worhp data fields

Parameters
scipSCIP data structure
problempointer to problem data structure

Definition at line 533 of file nlpi_worhp.c.

References NULL, SCIP_NlpiProblem::opt, SCIP_NlpiProblem::oracle, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBlockMemoryArray, SCIPfreeBlockMemoryArray, SCIPnlpiOracleEvalJacobian(), SCIPnlpiOracleGetNConstraints(), SCIPnlpiOracleGetNVars(), TRUE, and SCIP_NlpiProblem::wsp.

Referenced by SCIP_DECL_NLPISOLVE().

◆ userHM()

static SCIP_RETCODE userHM ( SCIP scip,
SCIP_NLPIPROBLEM problem 
)
static

computes hessian matrix and store the result in the corresponding Worhp data fields

Parameters
scipSCIP data structure
problempointer to problem data structure

Definition at line 578 of file nlpi_worhp.c.

References NULL, SCIP_NlpiProblem::opt, SCIP_NlpiProblem::oracle, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBlockMemoryArray, SCIPfreeBlockMemoryArray, SCIPnlpiOracleEvalHessianLag(), SCIPnlpiOracleGetHessianLagSparsity(), SCIPnlpiOracleGetNConstraints(), SCIPnlpiOracleGetNVars(), TRUE, and SCIP_NlpiProblem::wsp.

Referenced by SCIP_DECL_NLPISOLVE().

◆ noprint()

static void noprint ( int  mode,
const char  s[] 
)
static

Worhp print callback function that does nothing

Parameters
modethe mode
sa string

Definition at line 634 of file nlpi_worhp.c.

Referenced by SCIP_DECL_NLPISOLVE(), and SCIPincludeNlpSolverWorhp().

◆ initWorhp()

◆ updateWorhp()

◆ freeWorhp()

static SCIP_RETCODE freeWorhp ( SCIP_NLPIPROBLEM problem)
static

frees Worhp data

Parameters
problempointer to problem data structure

Definition at line 885 of file nlpi_worhp.c.

References SCIP_NlpiProblem::cnt, NULL, SCIP_NlpiProblem::opt, SCIP_NlpiProblem::par, SCIP_OKAY, and SCIP_NlpiProblem::wsp.

Referenced by SCIP_DECL_NLPIFREEPROBLEM(), and SCIP_DECL_NLPISOLVE().

◆ handleNlpParam()

static SCIP_RETCODE handleNlpParam ( SCIP scip,
SCIP_NLPI nlpi,
Params *  par,
const SCIP_NLPPARAM  nlpparam 
)
static

pass NLP solve parameters to Ipopt

Parameters
scipSCIP data structure
nlpiWorhp interface
parWorhp parameters
nlpparamNLP solve parameters

Definition at line 903 of file nlpi_worhp.c.

References DEFAULT_SCALEDKKT, SCIP_NlpParam::fastfail, SCIP_NlpParam::feastol, SCIP_NlpParam::iterlimit, SCIP_NlpParam::lobjlimit, NULL, SCIP_NlpParam::opttol, SCIP_OKAY, SCIP_REAL_MAX, SCIPdebugMsg, SCIPinfinity(), SCIPnlpiGetData(), SCIPwarningMessage(), SCIP_NlpParam::timelimit, TRUE, SCIP_NlpParam::verblevel, and SCIP_NlpParam::warmstart.

Referenced by SCIP_DECL_NLPISOLVE().

◆ SCIP_DECL_NLPICOPY()

static SCIP_DECL_NLPICOPY ( nlpiCopyWorhp  )
static

copy method of NLP interface (called when SCIP copies plugins)

Definition at line 961 of file nlpi_worhp.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPincludeNlpSolverWorhp(), and SCIPnlpiGetData().

◆ SCIP_DECL_NLPIFREE()

static SCIP_DECL_NLPIFREE ( nlpiFreeWorhp  )
static

destructor of NLP interface to free nlpi data

Definition at line 977 of file nlpi_worhp.c.

References NULL, SCIP_OKAY, and SCIPfreeBlockMemory.

◆ SCIP_DECL_NLPICREATEPROBLEM()

static SCIP_DECL_NLPICREATEPROBLEM ( nlpiCreateProblemWorhp  )
static

◆ SCIP_DECL_NLPIFREEPROBLEM()

static SCIP_DECL_NLPIFREEPROBLEM ( nlpiFreeProblemWorhp  )
static

◆ SCIP_DECL_NLPIADDVARS()

static SCIP_DECL_NLPIADDVARS ( nlpiAddVarsWorhp  )
static

add variables

Definition at line 1057 of file nlpi_worhp.c.

References invalidateSolution(), NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeMemoryArrayNull, SCIPnlpiOracleAddVars(), and TRUE.

◆ SCIP_DECL_NLPIADDCONSTRAINTS()

static SCIP_DECL_NLPIADDCONSTRAINTS ( nlpiAddConstraintsWorhp  )
static

add constraints

Definition at line 1075 of file nlpi_worhp.c.

References invalidateSolution(), NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiOracleAddConstraints(), and TRUE.

◆ SCIP_DECL_NLPISETOBJECTIVE()

static SCIP_DECL_NLPISETOBJECTIVE ( nlpiSetObjectiveWorhp  )
static

sets or overwrites objective, a minimization problem is expected

Definition at line 1094 of file nlpi_worhp.c.

References invalidateSolution(), NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiOracleIsConstraintNonlinear(), SCIPnlpiOracleSetObjective(), and TRUE.

◆ SCIP_DECL_NLPICHGVARBOUNDS()

static SCIP_DECL_NLPICHGVARBOUNDS ( nlpiChgVarBoundsWorhp  )
static

◆ SCIP_DECL_NLPICHGCONSSIDES()

static SCIP_DECL_NLPICHGCONSSIDES ( nlpiChgConsSidesWorhp  )
static

◆ SCIP_DECL_NLPIDELVARSET()

static SCIP_DECL_NLPIDELVARSET ( nlpiDelVarSetWorhp  )
static

delete a set of variables

Definition at line 1189 of file nlpi_worhp.c.

References invalidateSolution(), NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeMemoryArrayNull, SCIPnlpiOracleDelVarSet(), and TRUE.

◆ SCIP_DECL_NLPIDELCONSSET()

static SCIP_DECL_NLPIDELCONSSET ( nlpiDelConstraintSetWorhp  )
static

delete a set of constraints

Definition at line 1207 of file nlpi_worhp.c.

References invalidateSolution(), NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiOracleDelConsSet(), and TRUE.

◆ SCIP_DECL_NLPICHGLINEARCOEFS()

static SCIP_DECL_NLPICHGLINEARCOEFS ( nlpiChgLinearCoefsWorhp  )
static

changes (or adds) linear coefficients in a constraint or objective

Definition at line 1223 of file nlpi_worhp.c.

References invalidateSolution(), NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiOracleChgLinearCoefs(), and TRUE.

◆ SCIP_DECL_NLPICHGEXPR()

static SCIP_DECL_NLPICHGEXPR ( nlpiChgExprWorhp  )
static

replaces the expression of a constraint or objective

Definition at line 1239 of file nlpi_worhp.c.

References invalidateSolution(), NULL, SCIP_CALL, SCIP_OKAY, SCIPnlpiOracleChgExpr(), and TRUE.

◆ SCIP_DECL_NLPICHGOBJCONSTANT()

static SCIP_DECL_NLPICHGOBJCONSTANT ( nlpiChgObjConstantWorhp  )
static

change the constant offset in the objective

Definition at line 1255 of file nlpi_worhp.c.

References NULL, SCIP_CALL, SCIP_OKAY, and SCIPnlpiOracleChgObjConstant().

◆ SCIP_DECL_NLPISETINITIALGUESS()

static SCIP_DECL_NLPISETINITIALGUESS ( nlpiSetInitialGuessWorhp  )
static

sets initial guess for primal variables

Definition at line 1268 of file nlpi_worhp.c.

References BMScopyMemoryArray, NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateMemoryArray, SCIPfreeMemoryArrayNull, and SCIPnlpiOracleGetNVars().

◆ SCIP_DECL_NLPISOLVE()

◆ SCIP_DECL_NLPIGETSOLSTAT()

static SCIP_DECL_NLPIGETSOLSTAT ( nlpiGetSolstatWorhp  )
static

gives solution status

Definition at line 1519 of file nlpi_worhp.c.

References NULL.

◆ SCIP_DECL_NLPIGETTERMSTAT()

static SCIP_DECL_NLPIGETTERMSTAT ( nlpiGetTermstatWorhp  )
static

gives termination reason

Definition at line 1529 of file nlpi_worhp.c.

References NULL.

◆ SCIP_DECL_NLPIGETSOLUTION()

static SCIP_DECL_NLPIGETSOLUTION ( nlpiGetSolutionWorhp  )
static

gives primal and dual solution values

Definition at line 1539 of file nlpi_worhp.c.

References NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, and SCIPnlpiOracleEvalObjectiveValue().

◆ SCIP_DECL_NLPIGETSTATISTICS()

static SCIP_DECL_NLPIGETSTATISTICS ( nlpiGetStatisticsWorhp  )
static

gives solve statistics

Definition at line 1571 of file nlpi_worhp.c.

References NULL, SCIP_OKAY, and SCIPnlpiOracleGetEvalTime().