38 #include "worhp/worhp.h" 40 #if WORHP_MAJOR < 2 && WORHP_MINOR < 10 41 #error "Require at least Worhp 1.10" 44 #define NLPI_DESC "Worhp interface" 45 #define NLPI_PRIORITY_IP 0 46 #define NLPI_PRIORITY_SQP -2000 48 #define DEFAULT_VERBLEVEL 0 49 #define DEFAULT_SCALEDKKT TRUE 50 #define DEFAULT_MAXITER 3000 51 #define DEFAULT_RANDSEED 107 53 #define MAXPERTURB 0.01 117 assert(problem != NULL);
118 assert(problem->
blkmem != NULL);
141 assert(problem != NULL);
142 assert(problem->
opt != NULL);
143 assert(problem->
wsp != NULL);
144 assert(problem->
par != NULL);
145 assert(problem->
cnt != NULL);
147 switch( problem->
cnt->status )
182 SCIPdebugMessage(
"Worhp failed because of a NaN value in an evaluation!\n");
190 case MinimumStepsize:
192 case LinearSolverFailed:
195 SCIPdebugMessage(
"Worhp failed because of a numerical error during optimization!\n");
206 SCIPdebugMessage(
"Worhp failed because maximal number of calls or iterations is reached!\n");
223 case DivergingPrimal:
235 case LocalInfeasOptimal:
238 SCIPdebugMessage(
"Worhp failed because of convergence against infeasible stationary point!\n");
248 SCIPdebugMessage(
"Worhp failed because of convergence against infeasible stationary point!\n");
255 case RegularizationFailed:
258 SCIPdebugMessage(
"Worhp failed because of regularization of Hessian matrix failed!\n");
265 case OptimalSolution:
274 case OptimalSolutionConstantF:
277 SCIPdebugMessage(
"Worhp terminated successfully with a feasible point but KKT are not met!\n");
283 case AcceptableSolutionSKKT:
284 case AcceptableSolutionScaled:
285 case AcceptablePreviousScaled:
288 SCIPdebugMessage(
"Worhp terminated successfully with a feasible point but KKT are violated in unscaled space!\n");
294 case LowPassFilterOptimal:
297 SCIPdebugMessage(
"Worhp terminated at feasible solution without further progress!\n");
303 case FeasibleSolution:
306 SCIPdebugMessage(
"Worhp terminated at feasible solution, optimality was not required!\n");
312 case AcceptableSolution:
313 case AcceptableSolutionConstantF:
316 SCIPdebugMessage(
"Worhp terminated at acceptable solution due to limit or error!\n");
322 case AcceptablePrevious:
323 case AcceptablePreviousConstantF:
326 SCIPdebugMessage(
"Worhp previously found acceptable solution but terminated due to limit or error!\n");
332 case LowPassFilterAcceptable:
335 SCIPdebugMessage(
"Worhp found acceptable solution but terminated due no further progress!\n");
341 case SearchDirectionZero:
342 case SearchDirectionSmall:
345 SCIPdebugMessage(
"Worhp found acceptable solution but search direction is small or zero!\n");
356 SCIPdebugMessage(
"Worhp found acceptable solution but terminated perhaps due to nondifferentiability, unboundedness or at Fritz John point!\n");
364 SCIPerrorMessage(
"Worhp returned with unknown solution status %d\n", problem->
cnt->status);
374 if( problem->
opt->m > 0 )
380 if( problem->
opt->n > 0 )
398 for( i = 0; i < problem->
opt->n; ++i )
400 if( problem->
opt->Lambda[i] <= 0.0 )
428 assert(problem != NULL);
429 assert(problem->
oracle != NULL);
430 assert(problem->
blkmem != NULL);
431 assert(problem->
opt != NULL);
432 assert(problem->
wsp != NULL);
437 problem->
opt->F = problem->
wsp->ScaleObj * objval;
439 #ifdef SCIP_DEBUG_USERF 444 for( i = 0; i < problem->
opt->n; ++i )
445 printf(
" x[%d] = %g\n", i, problem->
opt->X[i]);
446 printf(
" obj = %g\n", problem->
opt->F);
459 assert(problem != NULL);
460 assert(problem->
oracle != NULL);
461 assert(problem->
blkmem != NULL);
462 assert(problem->
opt != NULL);
463 assert(problem->
wsp != NULL);
469 #ifdef SCIP_DEBUG_USERG 474 for( i = 0; i < problem->
opt->n; ++i )
475 printf(
" x[%d] = %g\n", i, problem->
opt->X[i]);
477 for( i = 0; i < problem->
opt->m; ++i )
478 printf(
" cons[%d] = %g\n", i, problem->
opt->G[i]);
493 assert(problem != NULL);
494 assert(problem->
oracle != NULL);
495 assert(problem->
blkmem != NULL);
496 assert(problem->
opt != NULL);
497 assert(problem->
wsp != NULL);
503 problem->
wsp->DF.val) );
506 if( problem->
wsp->ScaleObj != 1.0 )
509 for( i = 0; i < problem->
opt->n; ++i )
510 problem->
wsp->DF.val[i] *= problem->
wsp->ScaleObj;
513 #ifdef SCIP_DEBUG_USERDF 517 printf(
"userDF()\n");
518 for( i = 0; i < problem->
opt->n; ++i )
519 printf(
" x[%d] = %g\n", i, problem->
opt->X[i]);
521 for( i = 0; i < problem->
opt->n; ++i )
522 printf(
" DF[%d] = %g\n", i, problem->
wsp->DF.val[i]);
538 assert(problem != NULL);
539 assert(problem->
oracle != NULL);
540 assert(problem->
blkmem != NULL);
541 assert(problem->
opt != NULL);
542 assert(problem->
wsp != NULL);
554 for( i = 0; i < problem->
wsp->DG.nnz; ++i )
556 problem->
wsp->DG.val[i] = jacvals[ problem->
wsp->DG.perm[i]-1 ];
559 #ifdef SCIP_DEBUG_USERDG 560 printf(
"userDG()\n");
561 for( i = 0; i < problem->
opt->n; ++i )
562 printf(
" x[%d] = %g\n", i, problem->
opt->X[i]);
563 for( i = 0; i < problem->
wsp->DG.nnz; ++i )
564 printf(
" DG[%d] = %g\n", i, problem->
wsp->DG.val[i]);
585 assert(problem != NULL);
586 assert(problem->
oracle != NULL);
587 assert(problem->
blkmem != NULL);
588 assert(problem->
opt != NULL);
589 assert(problem->
wsp != NULL);
595 nnonz = offset[problem->
opt->n];
600 problem->
opt->Mu, hessianvals);
606 assert(problem->
wsp->HM.nnz >= nnonz);
607 for( i = 0; i < problem->
wsp->HM.nnz; ++i )
610 if( problem->
wsp->HM.perm[i] - 1 >= nnonz )
611 problem->
wsp->HM.val[i] = 0.0;
613 problem->
wsp->HM.val[i] = hessianvals[ problem->
wsp->HM.perm[i] - 1 ];
617 printf(
"userHM()\n");
618 for( i = 0; i < problem->
opt->n; ++i )
619 printf(
" x[%d] = %g\n", i, problem->
opt->X[i]);
620 for( i = 0; i < problem->
wsp->HM.nnz; ++i )
621 printf(
" HM[%d] = %g\n", i, problem->
wsp->HM.val[i]);
658 assert(nlpi != NULL);
659 assert(problem != NULL);
660 assert(problem->
cnt != NULL);
661 assert(problem->
wsp != NULL);
662 assert(problem->
par != NULL);
663 assert(problem->
opt != NULL);
672 assert(nlpidata != NULL);
675 WorhpPreInit(opt, wsp, par, cnt);
683 wsp->DF.nnz = opt->n;
687 wsp->DG.nnz = offset[opt->m];
698 for( i = 0; i < opt->n; ++i )
704 for( ; j < offset[i+1]; ++j )
713 assert(offset[opt->n] <= wsp->HM.nnz);
717 WorhpInit(opt, wsp, par, cnt);
718 if (cnt->status != FirstCall)
732 for( i = 0; i < opt->n; ++i )
739 for( i = 0; i < opt->m; ++i )
745 if( opt->GL[i] <= -nlpidata->infinity && opt->GU[i] >= nlpidata->infinity )
748 opt->GL[i] = -nlpidata->infinity / 10.0;
749 opt->GU[i] = nlpidata->infinity / 10.0;
759 for( i = 0; i < opt->n; ++i )
761 wsp->DF.row[i] = i + 1;
773 assert(offset[opt->m] == wsp->DG.nnz);
777 for( i = 0; i < opt->m; ++i )
779 for( ; j < offset[i+1]; ++j )
781 wsp->DG.row[nnonz] = i + 1;
782 wsp->DG.col[nnonz] = cols[j] + 1;
786 assert(nnonz == wsp->DG.nnz);
789 SortWorhpMatrix(&wsp->DG);
793 if( problem->
par->UserHM || problem->
par->FidifHM || problem->
par->BFGSmethod > 1 )
799 assert(offset[opt->n] <= wsp->HM.nnz);
804 for( i = 0; i < opt->n; ++i )
808 for( ; j < offset[i+1]; ++j )
810 problem->
wsp->HM.row[nnonz] = i + 1;
811 problem->
wsp->HM.col[nnonz] = cols[j] + 1;
821 problem->
wsp->HM.row[k] = i + 1;
822 problem->
wsp->HM.col[k] = i + 1;
826 assert(nnonz == offset[opt->n]);
827 assert(k == wsp->HM.nnz);
830 SortWorhpMatrix(&wsp->HM);
834 for( i = 0; i < wsp->HM.nnz; ++i )
836 SCIPdebugMessage(
" entry %d: (row,col) = (%d,%d)\n", i, wsp->HM.row[i], wsp->HM.col[i]);
854 assert(problem != NULL);
855 assert(problem->
cnt != NULL);
856 assert(problem->
wsp != NULL);
857 assert(problem->
par != NULL);
858 assert(problem->
opt != NULL);
859 assert(problem->
oracle != NULL);
863 WorhpRestart(problem->
opt, problem->
wsp, problem->
par, problem->
cnt);
868 for( i = 0; i < problem->
opt->n; ++i )
870 problem->
opt->XL[i] = lbs[i];
871 problem->
opt->XU[i] = ubs[i];
875 for( i = 0; i < problem->
opt->m; ++i )
890 assert(problem != NULL);
891 assert(problem->
cnt != NULL);
892 assert(problem->
wsp != NULL);
893 assert(problem->
par != NULL);
894 assert(problem->
opt != NULL);
896 if( problem->
opt->initialised )
897 WorhpFree(problem->
opt, problem->
wsp, problem->
par, problem->
cnt);
921 assert(sourcenlpi != NULL);
922 assert(targetnlpi != NULL);
925 assert(sourcedata != NULL);
928 assert(*targetnlpi != NULL);
946 assert(nlpi != NULL);
949 assert(data != NULL);
950 assert(data->blkmem != NULL);
969 assert(nlpi != NULL);
986 assert(nlpi != NULL);
987 assert(problem != NULL);
990 assert(data != NULL);
993 if( *problem == NULL )
998 (*problem)->blkmem = data->blkmem;
999 (*problem)->firstrun =
TRUE;
1009 WorhpPreInit((*problem)->opt, (*problem)->wsp, (*problem)->par, (*problem)->cnt);
1016 (*problem)->fromscratch = 0;
1019 (*problem)->fastfail = 0;
1038 assert(nlpi != NULL);
1039 assert(problem != NULL);
1040 assert(*problem != NULL);
1043 assert(data != NULL);
1045 if( (*problem)->opt != NULL )
1050 assert((*problem)->wsp != NULL);
1051 assert((*problem)->par != NULL);
1052 assert((*problem)->cnt != NULL);
1062 if( (*problem)->oracle != NULL )
1088 assert(nlpi != NULL);
1089 assert(problem != NULL);
1107 assert(nlpi != NULL);
1108 assert(problem != NULL);
1109 assert(problem->oracle != NULL);
1115 problem->firstrun =
TRUE;
1162 assert(nlpi != NULL);
1163 assert(problem != NULL);
1164 assert(problem->oracle != NULL);
1168 nlininds, lininds, linvals,
1169 nquadelems, quadelems,
1170 exprvaridxs, exprtrees, names) );
1173 problem->firstrun =
TRUE;
1208 assert(nlpi != NULL);
1209 assert(problem != NULL);
1210 assert(problem->oracle != NULL);
1218 problem->firstrun =
TRUE;
1221 constant, nlins, lininds, linvals,
1222 nquadelems, quadelems,
1223 exprvaridxs, exprtree) );
1243 #ifdef SCIP_DISABLED_CODE 1249 assert(nlpi != NULL);
1250 assert(problem != NULL);
1251 assert(problem->oracle != NULL);
1253 #ifdef SCIP_DISABLED_CODE 1258 for( i = 0; i < nvars; ++i )
1260 int index = indices[i];
1261 SCIPdebugMessage(
"change bounds of %d from [%g,%g] -> [%g,%g]\n", index, oldlbs[index], oldubs[index],
1264 if(
REALABS(lbs[i] - ubs[i]) <= problem->feastol )
1265 problem->firstrun =
TRUE;
1267 if(
REALABS(oldlbs[index] - oldubs[index]) <= problem->feastol )
1268 problem->firstrun =
TRUE;
1292 assert(nlpi != NULL);
1293 assert(problem != NULL);
1294 assert(problem->oracle != NULL);
1302 for( i = 0; i < nconss; ++i )
1304 int index = indices[i];
1307 SCIPdebugMessage(
"change constraint side of %d from [%g,%g] -> [%g,%g]\n", index, oldlhs, oldrhs, lhss[i], rhss[i]);
1332 assert(nlpi != NULL);
1333 assert(problem != NULL);
1334 assert(problem->oracle != NULL);
1341 problem->firstrun =
TRUE;
1359 assert(nlpi != NULL);
1360 assert(problem != NULL);
1361 assert(problem->oracle != NULL);
1366 problem->firstrun =
TRUE;
1384 assert(nlpi != NULL);
1385 assert(problem != NULL);
1386 assert(problem->oracle != NULL);
1391 problem->firstrun =
TRUE;
1410 assert(nlpi != NULL);
1411 assert(problem != NULL);
1412 assert(problem->oracle != NULL);
1417 problem->firstrun =
TRUE;
1434 assert(nlpi != NULL);
1435 assert(problem != NULL);
1436 assert(problem->oracle != NULL);
1441 problem->firstrun =
TRUE;
1460 assert(nlpi != NULL);
1461 assert(problem != NULL);
1462 assert(problem->oracle != NULL);
1481 assert(nlpi != NULL);
1482 assert(problem != NULL);
1483 assert(problem->oracle != NULL);
1503 assert(nlpi != NULL);
1504 assert(problem != NULL);
1505 assert(problem->oracle != NULL);
1507 if( primalvalues != NULL )
1509 if( !problem->initguess )
1537 Workspace* wsp = problem->wsp;
1538 Control* cnt = problem->cnt;
1539 OptVar* opt = problem->opt;
1540 Params* par = problem->par;
1544 problem->lastniter = -1;
1545 problem->lasttime = -1.0;
1547 if( problem->verblevel == 0 )
1556 SetWorhpPrint(WorhpDefaultPrintFunction);
1560 if( problem->firstrun )
1564 problem->firstrun =
FALSE;
1572 InitParams(&status, par);
1577 par->Algorithm = nlpidata->useip ? 2 : 1;
1581 par->Infty = nlpidata->infinity;
1582 par->TolFeas = problem->feastol;
1583 par->TolOpti = problem->relobjtol;
1584 par->TolComp = problem->relobjtol;
1585 par->Timeout = problem->timelim;
1586 par->MaxIter = problem->itlim;
1587 par->NLPprint = problem->verblevel - 1;
1589 #ifdef CHECKFUNVALUES 1591 par->CheckValuesDF =
TRUE;
1592 par->CheckValuesDG =
TRUE;
1593 par->CheckValuesHM =
TRUE;
1601 if( problem->initguess != NULL )
1609 assert(problem->randnumgen != NULL);
1611 SCIPdebugMessage(
"Worhp started without intial primal values; make up starting guess by projecting 0 onto variable bounds\n");
1613 for( i = 0; i < problem->opt->n; ++i )
1630 for( i = 0; i < problem->opt->n; ++i )
1644 while( cnt->status < TerminateSuccess && cnt->status > TerminateError )
1650 if( GetUserAction(cnt, callWorhp) )
1652 Worhp(opt, wsp, par, cnt);
1660 if( GetUserAction(cnt, iterOutput) )
1662 IterationOutput(opt, wsp, par, cnt);
1663 DoneUserAction(cnt, iterOutput);
1670 if( GetUserAction(cnt, evalF) )
1674 DoneUserAction(cnt, evalF);
1681 if( GetUserAction(cnt, evalG) )
1685 DoneUserAction(cnt, evalG);
1692 if( GetUserAction(cnt, evalDF) )
1696 DoneUserAction(cnt, evalDF);
1703 if( GetUserAction(cnt, evalDG) )
1707 DoneUserAction(cnt, evalDG);
1714 if( GetUserAction(cnt, evalHM) )
1718 DoneUserAction(cnt, evalHM);
1725 if( GetUserAction(cnt, fidif) )
1727 WorhpFidif(opt, wsp, par, cnt);
1733 if( cnt->status < TerminateSuccess && cnt->status > TerminateError )
1745 StatusMsg(opt, wsp, par, cnt);
1748 problem->lastniter = wsp->MajorIter;
1749 problem->lasttime = GetTimerCont(&cnt->Timer);
1765 assert(nlpi != NULL);
1766 assert(problem != NULL);
1768 return problem->lastsolstat;
1782 assert(nlpi != NULL);
1783 assert(problem != NULL);
1785 return problem->lasttermstat;
1807 assert(problem != NULL);
1809 if( primalvalues != NULL )
1810 *primalvalues = problem->lastprimal;
1812 if( consdualvalues != NULL )
1813 *consdualvalues = problem->lastdualcons;
1815 if( varlbdualvalues != NULL )
1816 *varlbdualvalues = problem->lastduallb;
1818 if( varubdualvalues != NULL )
1819 *varubdualvalues = problem->lastdualub;
1821 if( objval != NULL )
1823 if( problem->lastprimal != NULL )
1848 assert(nlpi != NULL);
1849 assert(problem != NULL);
1926 assert(nlpi != NULL);
1927 assert(ival != NULL);
1928 assert(problem != NULL);
1940 *ival = problem->verblevel;
1952 SCIPerrorMessage(
"relative objective tolerance parameter is of type real.\n");
1970 *ival = problem->itlim;
1988 *ival = problem->fastfail ? 1 : 0;
2013 assert(nlpi != NULL);
2014 assert(problem != NULL);
2020 if( ival == 0 || ival == 1 )
2022 SCIPdebugMessage(
"from scratch parameter not supported by Worhp interface yet. Ignored.\n");
2026 SCIPerrorMessage(
"Value %d for parameter from scratch out of range {0, 1}\n", ival);
2035 problem->verblevel = ival;
2047 SCIPerrorMessage(
"relative objective tolerance parameter is of type real.\n");
2066 problem->itlim = ival;
2069 SCIPerrorMessage(
"Value %d for parameter iteration limit is negative\n", ival);
2089 if( ival == 0 || ival == 1 )
2091 problem->fastfail = ival;
2095 SCIPerrorMessage(
"Value %d for parameter fastfail out of range {0, 1}\n", ival);
2127 assert(data != NULL);
2128 assert(dval != NULL);
2146 *dval = problem->feastol;
2152 *dval = problem->relobjtol;
2158 *dval = problem->lobjlim;
2164 *dval = data->infinity;
2176 *dval = problem->timelim;
2214 assert(data != NULL);
2232 problem->feastol = dval;
2238 problem->relobjtol = dval;
2244 problem->lobjlim = dval;
2250 data->infinity = dval;
2262 problem->timelim = dval;
2305 SCIPmessagePrintWarning(nlpidata->messagehdlr,
"optfile parameter not supported by Worhp interface yet. Ignored.\n");
2331 SCIPmessagePrintWarning(nlpidata->messagehdlr,
"optfile parameter not supported by Worhp interface yet. Ignored.\n");
2353 assert(nlpi != NULL);
2356 assert(nlpidata != NULL);
2358 nlpidata->messagehdlr = messagehdlr;
2378 assert(blkmem != NULL);
2379 assert(nlpi != NULL);
2385 nlpidata->blkmem = blkmem;
2386 nlpidata->useip = useip;
2392 (void) setenv(
"WORHP_DISABLE_KEYBOARD_HANDLER",
"1", 0);
2394 #if DEFAULT_VERBLEVEL == 0 2416 nlpiCopyWorhp, nlpiFreeWorhp, nlpiGetSolverPointerWorhp,
2417 nlpiCreateProblemWorhp, nlpiFreeProblemWorhp, nlpiGetProblemPointerWorhp,
2418 nlpiAddVarsWorhp, nlpiAddConstraintsWorhp, nlpiSetObjectiveWorhp,
2419 nlpiChgVarBoundsWorhp, nlpiChgConsSidesWorhp, nlpiDelVarSetWorhp, nlpiDelConstraintSetWorhp,
2420 nlpiChgLinearCoefsWorhp, nlpiChgQuadraticCoefsWorhp, nlpiChgExprtreeWorhp, nlpiChgNonlinCoefWorhp,
2421 nlpiChgObjConstantWorhp, nlpiSetInitialGuessWorhp, nlpiSolveWorhp, nlpiGetSolstatWorhp, nlpiGetTermstatWorhp,
2422 nlpiGetSolutionWorhp, nlpiGetStatisticsWorhp,
2423 nlpiGetWarmstartSizeWorhp, nlpiGetWarmstartMemoWorhp, nlpiSetWarmstartMemoWorhp,
2424 nlpiGetIntParWorhp, nlpiSetIntParWorhp, nlpiGetRealParWorhp, nlpiSetRealParWorhp, nlpiGetStringParWorhp, nlpiSetStringParWorhp,
2425 nlpiSetMessageHdlrWorhp,
2436 #ifdef WORHP_VERSION 2437 return "WORHP " WORHP_VERSION;
2439 static char solvername[20];
2440 sprintf(solvername,
"WORHP %d.%d." WORHP_PATCH, WORHP_MAJOR, WORHP_MINOR);
2450 return "Nonlinear programming solver developed at Research Institute Steinbeis (www.worhp.de)";
static SCIP_DECL_NLPICHGEXPRTREE(nlpiChgExprtreeWorhp)
SCIP_RETCODE SCIPnlpiOracleEvalConstraintValues(SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Real *convals)
#define BMSfreeBlockMemoryArrayNull(mem, ptr, num)
static SCIP_DECL_NLPICHGOBJCONSTANT(nlpiChgObjConstantWorhp)
enum SCIP_NlpTermStat SCIP_NLPTERMSTAT
static SCIP_RETCODE userDG(SCIP_NLPIPROBLEM *problem)
static void noprint(int mode, const char s[])
const SCIP_Real * SCIPnlpiOracleGetVarUbs(SCIP_NLPIORACLE *oracle)
#define BMSfreeMemoryArrayNull(ptr)
methods to interpret (evaluate) an expression tree "fast"
SCIP_RETCODE SCIPnlpiOracleGetJacobianSparsity(SCIP_NLPIORACLE *oracle, const int **offset, const int **col)
static SCIP_DECL_NLPIGETINTPAR(nlpiGetIntParWorhp)
SCIP_RETCODE SCIPnlpiOracleGetHessianLagSparsity(SCIP_NLPIORACLE *oracle, const int **offset, const int **col)
SCIP_NLPSOLSTAT lastsolstat
int SCIPnlpiOracleGetNVars(SCIP_NLPIORACLE *oracle)
static SCIP_DECL_NLPICHGVARBOUNDS(nlpiChgVarBoundsWorhp)
static SCIP_DECL_NLPISETSTRINGPAR(nlpiSetStringParWorhp)
static SCIP_DECL_NLPICHGQUADCOEFS(nlpiChgQuadraticCoefsWorhp)
static SCIP_DECL_NLPIGETPROBLEMPOINTER(nlpiGetProblemPointerWorhp)
static void invalidateSolution(SCIP_NLPIPROBLEM *problem)
#define NLPI_PRIORITY_SQP
static SCIP_DECL_NLPICHGNONLINCOEF(nlpiChgNonlinCoefWorhp)
internal methods for NLPI solver interfaces
static SCIP_RETCODE evaluateWorhpRun(SCIP_NLPIPROBLEM *problem)
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)
static SCIP_DECL_NLPISETINTPAR(nlpiSetIntParWorhp)
methods to store an NLP and request function, gradient, and hessian values
const char * SCIPgetSolverDescWorhp(void)
static SCIP_DECL_NLPISETINITIALGUESS(nlpiSetInitialGuessWorhp)
static SCIP_DECL_NLPIGETWARMSTARTMEMO(nlpiGetWarmstartMemoWorhp)
SCIP_Real SCIPnlpiOracleGetConstraintLhs(SCIP_NLPIORACLE *oracle, int considx)
static SCIP_DECL_NLPIADDVARS(nlpiAddVarsWorhp)
int SCIPsnprintf(char *t, int len, const char *s,...)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPnlpiOracleEvalObjectiveValue(SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Real *objval)
static SCIP_DECL_NLPIGETSOLUTION(nlpiGetSolutionWorhp)
SCIP_RETCODE SCIPnlpiSetMessageHdlr(SCIP_NLPI *nlpi, SCIP_MESSAGEHDLR *messagehdlr)
SCIP_RETCODE SCIPnlpiOracleEvalObjectiveGradient(SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real *objval, SCIP_Real *objgrad)
SCIP_RETCODE SCIPnlpiOracleDelConsSet(SCIP_NLPIORACLE *oracle, int *delstats)
SCIP_RETCODE SCIPnlpiOracleChgObjConstant(SCIP_NLPIORACLE *oracle, SCIP_Real objconstant)
int SCIPnlpiOracleGetNConstraints(SCIP_NLPIORACLE *oracle)
static SCIP_DECL_NLPIGETSTRINGPAR(nlpiGetStringParWorhp)
#define BMSduplicateBlockMemoryArray(mem, ptr, source, num)
int SCIPnlpiOracleGetConstraintDegree(SCIP_NLPIORACLE *oracle, int considx)
SCIP_RETCODE SCIPnlpiOracleChgExprtree(SCIP_NLPIORACLE *oracle, int considx, const int *exprvaridxs, const SCIP_EXPRTREE *exprtree)
SCIP_RETCODE SCIPnlpiOracleCreate(BMS_BLKMEM *blkmem, SCIP_NLPIORACLE **oracle)
const SCIP_Real * SCIPnlpiOracleGetVarLbs(SCIP_NLPIORACLE *oracle)
static SCIP_DECL_NLPISETMESSAGEHDLR(nlpiSetMessageHdlrWorhp)
SCIP_RETCODE SCIPnlpiOracleChgVarBounds(SCIP_NLPIORACLE *oracle, int nvars, const int *indices, const SCIP_Real *lbs, const SCIP_Real *ubs)
struct SCIP_NlpiData SCIP_NLPIDATA
static SCIP_RETCODE userHM(SCIP_NLPIPROBLEM *problem)
enum SCIP_NlpSolStat SCIP_NLPSOLSTAT
SCIP_RETCODE SCIPnlpiOracleAddVars(SCIP_NLPIORACLE *oracle, int nvars, const SCIP_Real *lbs, const SCIP_Real *ubs, const char **varnames)
static SCIP_DECL_NLPIADDCONSTRAINTS(nlpiAddConstraintsWorhp)
void SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
internal miscellaneous methods
void SCIPrandomFree(SCIP_RANDNUMGEN **randnumgen, BMS_BLKMEM *blkmem)
static SCIP_DECL_NLPIDELVARSET(nlpiDelVarSetWorhp)
static SCIP_DECL_NLPIGETTERMSTAT(nlpiGetTermstatWorhp)
static SCIP_DECL_NLPICOPY(nlpiCopyWorhp)
#define SCIP_DEFAULT_FEASTOL
SCIP_Bool SCIPisWorhpAvailableWorhp(void)
static SCIP_DECL_NLPIGETREALPAR(nlpiGetRealParWorhp)
static SCIP_DECL_NLPISOLVE(nlpiSolveWorhp)
static SCIP_DECL_NLPIDELCONSSET(nlpiDelConstraintSetWorhp)
SCIP_Real SCIPnlpiOracleGetConstraintRhs(SCIP_NLPIORACLE *oracle, int considx)
#define BMSduplicateMemoryArray(ptr, source, num)
SCIP_RETCODE SCIPnlpiOracleFree(SCIP_NLPIORACLE **oracle)
methods for catching the user CTRL-C interrupt
#define BMSfreeBlockMemory(mem, ptr)
static SCIP_DECL_NLPIFREE(nlpiFreeWorhp)
SCIP_RETCODE SCIPnlpiCreate(SCIP_NLPI **nlpi, const char *name, const char *description, int priority, SCIP_DECL_NLPICOPY((*nlpicopy)), SCIP_DECL_NLPIFREE((*nlpifree)), SCIP_DECL_NLPIGETSOLVERPOINTER((*nlpigetsolverpointer)), SCIP_DECL_NLPICREATEPROBLEM((*nlpicreateproblem)), SCIP_DECL_NLPIFREEPROBLEM((*nlpifreeproblem)), SCIP_DECL_NLPIGETPROBLEMPOINTER((*nlpigetproblempointer)), SCIP_DECL_NLPIADDVARS((*nlpiaddvars)), SCIP_DECL_NLPIADDCONSTRAINTS((*nlpiaddconstraints)), SCIP_DECL_NLPISETOBJECTIVE((*nlpisetobjective)), SCIP_DECL_NLPICHGVARBOUNDS((*nlpichgvarbounds)), SCIP_DECL_NLPICHGCONSSIDES((*nlpichgconssides)), SCIP_DECL_NLPIDELVARSET((*nlpidelvarset)), SCIP_DECL_NLPIDELCONSSET((*nlpidelconsset)), SCIP_DECL_NLPICHGLINEARCOEFS((*nlpichglinearcoefs)), SCIP_DECL_NLPICHGQUADCOEFS((*nlpichgquadcoefs)), SCIP_DECL_NLPICHGEXPRTREE((*nlpichgexprtree)), SCIP_DECL_NLPICHGNONLINCOEF((*nlpichgnonlincoef)), SCIP_DECL_NLPICHGOBJCONSTANT((*nlpichgobjconstant)), SCIP_DECL_NLPISETINITIALGUESS((*nlpisetinitialguess)), SCIP_DECL_NLPISOLVE((*nlpisolve)), SCIP_DECL_NLPIGETSOLSTAT((*nlpigetsolstat)), SCIP_DECL_NLPIGETTERMSTAT((*nlpigettermstat)), SCIP_DECL_NLPIGETSOLUTION((*nlpigetsolution)), SCIP_DECL_NLPIGETSTATISTICS((*nlpigetstatistics)), SCIP_DECL_NLPIGETWARMSTARTSIZE((*nlpigetwarmstartsize)), SCIP_DECL_NLPIGETWARMSTARTMEMO((*nlpigetwarmstartmemo)), SCIP_DECL_NLPISETWARMSTARTMEMO((*nlpisetwarmstartmemo)), SCIP_DECL_NLPIGETINTPAR((*nlpigetintpar)), SCIP_DECL_NLPISETINTPAR((*nlpisetintpar)), SCIP_DECL_NLPIGETREALPAR((*nlpigetrealpar)), SCIP_DECL_NLPISETREALPAR((*nlpisetrealpar)), SCIP_DECL_NLPIGETSTRINGPAR((*nlpigetstringpar)), SCIP_DECL_NLPISETSTRINGPAR((*nlpisetstringpar)), SCIP_DECL_NLPISETMESSAGEHDLR((*nlpisetmessagehdlr)), SCIP_NLPIDATA *nlpidata)
SCIP_RETCODE SCIPnlpiOraclePrintProblem(SCIP_NLPIORACLE *oracle, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
#define BMSallocBlockMemoryArray(mem, ptr, num)
SCIP_RETCODE SCIPnlpiOracleSetProblemName(SCIP_NLPIORACLE *oracle, const char *name)
static SCIP_DECL_NLPICHGCONSSIDES(nlpiChgConsSidesWorhp)
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)
#define BMSfreeBlockMemoryArray(mem, ptr, num)
void SCIPnlpStatisticsSetNIterations(SCIP_NLPSTATISTICS *statistics, int niterations)
static SCIP_RETCODE userDF(SCIP_NLPIPROBLEM *problem)
void SCIPnlpStatisticsSetTotalTime(SCIP_NLPSTATISTICS *statistics, SCIP_Real totaltime)
static SCIP_DECL_NLPISETOBJECTIVE(nlpiSetObjectiveWorhp)
static SCIP_RETCODE userF(SCIP_NLPIPROBLEM *problem)
SCIP_RETCODE SCIPnlpiOracleChgLinearCoefs(SCIP_NLPIORACLE *oracle, int considx, int nentries, const int *varidxs, const SCIP_Real *newcoefs)
#define BMScopyMemoryArray(ptr, source, num)
SCIP_RETCODE SCIPnlpiOracleChgQuadCoefs(SCIP_NLPIORACLE *oracle, int considx, int nquadelems, const SCIP_QUADELEM *quadelems)
static SCIP_DECL_NLPIFREEPROBLEM(nlpiFreeProblemWorhp)
SCIP_RETCODE SCIPnlpiOracleChgConsSides(SCIP_NLPIORACLE *oracle, int nconss, const int *indices, const SCIP_Real *lhss, const SCIP_Real *rhss)
#define BMSclearMemory(ptr)
static SCIP_RETCODE updateWorhp(SCIP_NLPIPROBLEM *problem)
static SCIP_DECL_NLPIGETSOLVERPOINTER(nlpiGetSolverPointerWorhp)
SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randnumgen, SCIP_Real minrandval, SCIP_Real maxrandval)
SCIP_RETCODE SCIPnlpiOracleDelVarSet(SCIP_NLPIORACLE *oracle, int *delstats)
const char * SCIPgetSolverNameWorhp(void)
static SCIP_DECL_NLPICHGLINEARCOEFS(nlpiChgLinearCoefsWorhp)
static SCIP_RETCODE initWorhp(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
#define SCIP_DEFAULT_INFINITY
SCIP_RETCODE SCIPnlpiOracleChgExprParam(SCIP_NLPIORACLE *oracle, int considx, int paramidx, SCIP_Real paramval)
SCIP_NLPIDATA * SCIPnlpiGetData(SCIP_NLPI *nlpi)
static SCIP_DECL_NLPIGETSTATISTICS(nlpiGetStatisticsWorhp)
SCIP_RETCODE SCIPnlpiOracleEvalHessianLag(SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real objfactor, const SCIP_Real *lambda, SCIP_Real *hessian)
static SCIP_DECL_NLPIGETWARMSTARTSIZE(nlpiGetWarmstartSizeWorhp)
SCIP_RANDNUMGEN * randnumgen
SCIP_NLPTERMSTAT lasttermstat
static SCIP_DECL_NLPISETREALPAR(nlpiSetRealParWorhp)
SCIP_RETCODE SCIPrandomCreate(SCIP_RANDNUMGEN **randnumgen, BMS_BLKMEM *blkmem, unsigned int initialseed)
static SCIP_RETCODE freeWorhp(SCIP_NLPIPROBLEM *problem)
SCIP_RETCODE SCIPnlpiOracleSetInfinity(SCIP_NLPIORACLE *oracle, SCIP_Real infinity)
static SCIP_DECL_NLPISETWARMSTARTMEMO(nlpiSetWarmstartMemoWorhp)
static SCIP_RETCODE userG(SCIP_NLPIPROBLEM *problem)
static SCIP_DECL_NLPICREATEPROBLEM(nlpiCreateProblemWorhp)
SCIP_RETCODE SCIPnlpiOracleEvalJacobian(SCIP_NLPIORACLE *oracle, const SCIP_Real *x, SCIP_Bool isnewx, SCIP_Real *convals, SCIP_Real *jacobi)
#define BMSallocBlockMemory(mem, ptr)
SCIP_RETCODE SCIPcreateNlpSolverWorhp(BMS_BLKMEM *blkmem, SCIP_NLPI **nlpi, SCIP_Bool useip)
#define DEFAULT_VERBLEVEL
struct BMS_BlkMem BMS_BLKMEM
static SCIP_DECL_NLPIGETSOLSTAT(nlpiGetSolstatWorhp)
SCIP_RETCODE SCIPnlpiSetRealPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, SCIP_Real dval)
#define DEFAULT_SCALEDKKT