Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
Joris Gillis committed Apr 17, 2018
1 parent 592abd0 commit 65dcbd5
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions casadi/interfaces/worhp/worhp_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,14 @@ namespace casadi {
// Reverse Communication loop
while (m->worhp_c.status < TerminateSuccess && m->worhp_c.status > TerminateError) {
if (GetUserAction(&m->worhp_c, callWorhp)) {
if (verbose_) casadi_message("WorhpInterface::callWorhp enter");
Worhp(&m->worhp_o, &m->worhp_w, &m->worhp_p, &m->worhp_c);
if (verbose_) casadi_message("WorhpInterface::callWorhp exit");
}


if (GetUserAction(&m->worhp_c, iterOutput)) {

if (verbose_) casadi_message("WorhpInterface::iterOutput enter");
if (!firstIteration) {
firstIteration = true;

Expand Down Expand Up @@ -449,49 +451,59 @@ namespace casadi {
}
}


if (verbose_) casadi_message("WorhpInterface::iterOutput interm");
IterationOutput(&m->worhp_o, &m->worhp_w, &m->worhp_p, &m->worhp_c);
DoneUserAction(&m->worhp_c, iterOutput);
if (verbose_) casadi_message("WorhpInterface::iterOutput exit");
}

if (GetUserAction(&m->worhp_c, evalF)) {
if (verbose_) casadi_message("WorhpInterface::evalF enter");
m->arg[0] = m->worhp_o.X;
m->arg[1] = m->p;
m->res[0] = &m->worhp_o.F;
calc_function(m, "nlp_f");
m->f = m->worhp_o.F; // Store cost, before scaling
m->worhp_o.F *= m->worhp_w.ScaleObj;
DoneUserAction(&m->worhp_c, evalF);
if (verbose_) casadi_message("WorhpInterface::evalF exit");
}

if (GetUserAction(&m->worhp_c, evalG)) {
if (verbose_) casadi_message("WorhpInterface::evalG enter");
m->arg[0] = m->worhp_o.X;
m->arg[1] = m->p;
m->res[0] = m->worhp_o.G;
calc_function(m, "nlp_g");
DoneUserAction(&m->worhp_c, evalG);
if (verbose_) casadi_message("WorhpInterface::evalG exit");
}

if (GetUserAction(&m->worhp_c, evalDF)) {
if (verbose_) casadi_message("WorhpInterface::evalDF enter");
m->arg[0] = m->worhp_o.X;
m->arg[1] = m->p;
m->res[0] = nullptr;
m->res[1] = m->worhp_w.DF.val;
calc_function(m, "nlp_grad_f");
casadi_scal(nx_, m->worhp_w.ScaleObj, m->worhp_w.DF.val);
DoneUserAction(&m->worhp_c, evalDF);
if (verbose_) casadi_message("WorhpInterface::evalDF exit");
}

if (GetUserAction(&m->worhp_c, evalDG)) {
if (verbose_) casadi_message("WorhpInterface::evalDG enter");
m->arg[0] = m->worhp_o.X;
m->arg[1] = m->p;
m->res[0] = nullptr;
m->res[1] = m->worhp_w.DG.val;
calc_function(m, "nlp_jac_g");
DoneUserAction(&m->worhp_c, evalDG);
if (verbose_) casadi_message("WorhpInterface::evalDG exit");
}

if (GetUserAction(&m->worhp_c, evalHM)) {
if (verbose_) casadi_message("WorhpInterface::evalHM enter");
m->arg[0] = m->worhp_o.X;
m->arg[1] = m->p;
m->arg[2] = &m->worhp_w.ScaleObj;
Expand Down Expand Up @@ -519,10 +531,13 @@ namespace casadi {
// Add diagonal entries at the end
casadi_copy(dval, nx_, m->worhp_w.HM.val+ind);
DoneUserAction(&m->worhp_c, evalHM);
if (verbose_) casadi_message("WorhpInterface::evalHM exit");
}

if (GetUserAction(&m->worhp_c, fidif)) {
if (verbose_) casadi_message("WorhpInterface::FD enter");
WorhpFidif(&m->worhp_o, &m->worhp_w, &m->worhp_p, &m->worhp_c);
if (verbose_) casadi_message("WorhpInterface::FD exit");
}
}

Expand Down

0 comments on commit 65dcbd5

Please sign in to comment.