In a somewhat complex non-linear programming model, I observed the following. I do here two solves in a row:
solve m2 minimizing zrf using dnlp; solve m2 minimizing zrf using dnlp; |
We solve the model, and then in the second solve we use the optimal solution from the first solve as an initial point. This should make the second solve rather easy! But what I see is somewhat different.
The first solve has no problems. (I fed it a close to optimal initial point). The log looks like:
--- Generating DNLP model m2 |
We are hopeful the second solve should be even easier, but we see:
--- Generating DNLP model m2 |
How can an optimal solution be an invalid initial point?
My analysis is the following:
- The equation we cannot generate is part of what Conopt calls “Post-triangular equations”. These equations are set aside by Conopt when solving the model, and are reintroduced just before reporting the solution because Conopt knows these equations will not change the solution. Typically “accounting rows” are such equations. These are constraints that could have been implemented as assignments in post-processing as they just calculate some additional information about the solution. In most cases these post-triangular equations do not require the evaluation of gradients.
- When we generate the model again for the second time, GAMS will try to evaluate the gradients. It is here where we encounter the overflow. In this model things are way more complicated but think about the function \(f(x)=\sqrt{x}\) at \(x=0\). The function itself can be evaluated at \(x=0\), but the gradient can not. (Actually GAMS will patch the derivative of \(\sqrt{x}\) at \(x=0\) to fix this, but it is not smart enough to do this on my functions).
- This also means that there is a architectural flaw here: we should do the presolve before evaluating gradients. Here GAMS will evaluate gradients, and subsequently CONOPT will presolve the model. This is exactly in the wrong order. Note that AMPL will do a presolve in the generation of the model opposed to GAMS which leaves it to the solver. I believe AMPL is doing the right thing here.
A work-around is:
solve m2 minimizing zrf using dnlp; |
No comments:
Post a Comment