Detailed Description
Worhp NLP interface.
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()
|
static |
clears the last solution information
- Parameters
-
scip SCIP data structure problem pointer to problem data structure
Definition at line 114 of file nlpi_worhp.c.
References SCIP_NlpiProblem::lastdualcons, SCIP_NlpiProblem::lastdualconssize, SCIP_NlpiProblem::lastduallb, SCIP_NlpiProblem::lastduallbsize, SCIP_NlpiProblem::lastdualub, SCIP_NlpiProblem::lastdualubsize, SCIP_NlpiProblem::lastprimal, SCIP_NlpiProblem::lastprimalsize, SCIP_NlpiProblem::lastsolstat, SCIP_NlpiProblem::lasttermstat, NULL, SCIP_NLPSOLSTAT_UNKNOWN, SCIP_NLPTERMSTAT_OTHER, and SCIPfreeBlockMemoryArrayNull.
Referenced by evaluateWorhpRun(), SCIP_DECL_NLPIADDCONSTRAINTS(), SCIP_DECL_NLPIADDVARS(), SCIP_DECL_NLPICHGCONSSIDES(), SCIP_DECL_NLPICHGEXPR(), SCIP_DECL_NLPICHGLINEARCOEFS(), SCIP_DECL_NLPICHGVARBOUNDS(), SCIP_DECL_NLPIDELCONSSET(), SCIP_DECL_NLPIDELVARSET(), SCIP_DECL_NLPIFREEPROBLEM(), and SCIP_DECL_NLPISETOBJECTIVE().
◆ evaluateWorhpRun()
|
static |
evaluate last Worhp run
- Parameters
-
scip SCIP data structure problem pointer to problem data structure
Definition at line 136 of file nlpi_worhp.c.
References BMScopyMemoryArray, SCIP_NlpiProblem::cnt, invalidateSolution(), SCIP_NlpiProblem::lastdualcons, SCIP_NlpiProblem::lastdualconssize, SCIP_NlpiProblem::lastduallb, SCIP_NlpiProblem::lastduallbsize, SCIP_NlpiProblem::lastdualub, SCIP_NlpiProblem::lastdualubsize, SCIP_NlpiProblem::lastprimal, SCIP_NlpiProblem::lastprimalsize, SCIP_NlpiProblem::lastsolstat, SCIP_NlpiProblem::lasttermstat, NULL, SCIP_NlpiProblem::opt, SCIP_NlpiProblem::par, SCIP_CALL, SCIP_NLPSOLSTAT_FEASIBLE, SCIP_NLPSOLSTAT_GLOBINFEASIBLE, SCIP_NLPSOLSTAT_LOCINFEASIBLE, SCIP_NLPSOLSTAT_LOCOPT, SCIP_NLPSOLSTAT_UNBOUNDED, SCIP_NLPSOLSTAT_UNKNOWN, SCIP_NLPTERMSTAT_EVALERROR, SCIP_NLPTERMSTAT_ITERLIMIT, SCIP_NLPTERMSTAT_LICENSEERROR, SCIP_NLPTERMSTAT_NUMERICERROR, SCIP_NLPTERMSTAT_OKAY, SCIP_NLPTERMSTAT_OTHER, SCIP_NLPTERMSTAT_OUTOFMEMORY, SCIP_NLPTERMSTAT_TIMELIMIT, SCIP_OKAY, SCIPallocBlockMemoryArray, SCIPdebugMsg, SCIPduplicateBlockMemoryArray, SCIPerrorMessage, and SCIP_NlpiProblem::wsp.
Referenced by SCIP_DECL_NLPISOLVE().
◆ userF()
|
static |
evaluates objective function and store the result in the corresponding Worhp data fields
- Parameters
-
scip SCIP data structure problem pointer 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 |
evaluates constraints and store the result in the corresponding Worhp data fields
- Parameters
-
scip SCIP data structure problem pointer 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 |
computes objective gradient and store the result in the corresponding Worhp data fields
- Parameters
-
scip SCIP data structure problem pointer 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 |
computes jacobian matrix and store the result in the corresponding Worhp data fields
- Parameters
-
scip SCIP data structure problem pointer 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 |
computes hessian matrix and store the result in the corresponding Worhp data fields
- Parameters
-
scip SCIP data structure problem pointer 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 |
Worhp print callback function that does nothing
- Parameters
-
mode the mode s a string
Definition at line 634 of file nlpi_worhp.c.
Referenced by SCIP_DECL_NLPISOLVE(), and SCIPincludeNlpSolverWorhp().
◆ initWorhp()
|
static |
initialize Worhp data
- Parameters
-
scip SCIP data structure nlpi pointer to NLPI datastructure problem pointer to problem data structure
Definition at line 643 of file nlpi_worhp.c.
References BMScopyMemoryArray, SCIP_NlpiProblem::cnt, FALSE, SCIP_NlpiProblem::firstrun, NULL, SCIP_NlpiProblem::opt, SCIP_NlpiProblem::oracle, SCIP_NlpiProblem::par, SCIP_Bool, SCIP_CALL, SCIP_ERROR, SCIP_OKAY, SCIP_Real, SCIPdebugMsg, SCIPdebugPrintf, SCIPerrorMessage, SCIPinfinity(), SCIPisInfinity(), SCIPnlpiOracleGetConstraintLhs(), SCIPnlpiOracleGetConstraintRhs(), SCIPnlpiOracleGetHessianLagSparsity(), SCIPnlpiOracleGetJacobianSparsity(), SCIPnlpiOracleGetNConstraints(), SCIPnlpiOracleGetNVars(), SCIPnlpiOracleGetVarLbs(), SCIPnlpiOracleGetVarUbs(), SCIPwarningMessage(), TRUE, and SCIP_NlpiProblem::wsp.
Referenced by SCIP_DECL_NLPISOLVE().
◆ updateWorhp()
|
static |
update Worhp data
- Parameters
-
problem pointer to problem data structure
Definition at line 845 of file nlpi_worhp.c.
References SCIP_NlpiProblem::cnt, NULL, SCIP_NlpiProblem::opt, SCIP_NlpiProblem::oracle, SCIP_NlpiProblem::par, SCIP_OKAY, SCIP_Real, SCIPnlpiOracleGetConstraintLhs(), SCIPnlpiOracleGetConstraintRhs(), SCIPnlpiOracleGetNConstraints(), SCIPnlpiOracleGetNVars(), SCIPnlpiOracleGetVarLbs(), SCIPnlpiOracleGetVarUbs(), and SCIP_NlpiProblem::wsp.
Referenced by SCIP_DECL_NLPISOLVE().
◆ freeWorhp()
|
static |
frees Worhp data
- Parameters
-
problem pointer 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 |
pass NLP solve parameters to Ipopt
- Parameters
-
scip SCIP data structure nlpi Worhp interface par Worhp parameters nlpparam NLP 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 |
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 |
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 |
creates a problem instance
Definition at line 991 of file nlpi_worhp.c.
References DEFAULT_RANDSEED, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPallocClearBlockMemory, SCIPcreateRandom(), SCIPnlpiOracleCreate(), SCIPnlpiOracleSetProblemName(), and TRUE.
◆ SCIP_DECL_NLPIFREEPROBLEM()
|
static |
free a problem instance
Definition at line 1019 of file nlpi_worhp.c.
References freeWorhp(), invalidateSolution(), NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeBlockMemory, SCIPfreeMemoryArrayNull, SCIPfreeRandom(), and SCIPnlpiOracleFree().
◆ SCIP_DECL_NLPIADDVARS()
|
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 |
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 |
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 |
change variable bounds
Definition at line 1118 of file nlpi_worhp.c.
References invalidateSolution(), NULL, REALABS, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPdebugMsg, SCIPnlpiOracleChgVarBounds(), SCIPnlpiOracleGetVarLbs(), SCIPnlpiOracleGetVarUbs(), and TRUE.
◆ SCIP_DECL_NLPICHGCONSSIDES()
|
static |
change constraint bounds
Definition at line 1158 of file nlpi_worhp.c.
References invalidateSolution(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPdebugMsg, SCIPnlpiOracleChgConsSides(), SCIPnlpiOracleGetConstraintLhs(), and SCIPnlpiOracleGetConstraintRhs().
◆ SCIP_DECL_NLPIDELVARSET()
|
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 |
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 |
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 |
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 |
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 |
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()
|
static |
tries to solve NLP
Definition at line 1295 of file nlpi_worhp.c.
References BMScopyMemoryArray, evaluateWorhpRun(), FALSE, freeWorhp(), handleNlpParam(), initWorhp(), MAX, MAXPERTURB, MIN, noprint(), NULL, SCIP_CALL, SCIP_INVALIDCALL, SCIP_NLPPARAM_PRINT, SCIP_NLPSOLSTAT_UNKNOWN, SCIP_NLPTERMSTAT_INTERRUPT, SCIP_NLPTERMSTAT_NUMERICERROR, SCIP_NLPTERMSTAT_TIMELIMIT, SCIP_OKAY, SCIP_Real, SCIPdebugMsg, SCIPisSolveInterrupted(), SCIPnlpiOracleGetVarLbs(), SCIPnlpiOracleGetVarUbs(), SCIPnlpiOraclePrintProblem(), SCIPnlpiOracleResetEvalTime(), SCIPrandomGetReal(), SCIPwarningMessage(), updateWorhp(), userDF(), userDG(), userF(), userG(), and userHM().
◆ SCIP_DECL_NLPIGETSOLSTAT()
|
static |
◆ SCIP_DECL_NLPIGETTERMSTAT()
|
static |
◆ SCIP_DECL_NLPIGETSOLUTION()
|
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 |
gives solve statistics
Definition at line 1571 of file nlpi_worhp.c.
References NULL, SCIP_OKAY, and SCIPnlpiOracleGetEvalTime().