[Ipopt] Are piecewise functions constraints depending of a state variable allowed?
Stefan Vigerske
stefan at math.hu-berlin.de
Wed Oct 12 04:46:57 EDT 2016
Hi,
if your function and gradient are continuous, then it should be ok that
it is piecewise linear. Would be better if also the Hessian is continuous.
If you use some AD code to compute the derivative for an evaluation code
that uses if's, then it can be trickier to get the correct derivatives.
Retaping for every new point could be an option, but might cost
performance. I cannot comment in detail on this, the AD code
documentation should help on this.
Stefan
On 10/12/2016 02:06 AM, Pablo Perez wrote:
> Hello,
>
> I am researching in nlp applied to optimal control, specifically in an very simple electric point mass vehicle model based in the ampl example provide by Ipopt source code and defined by the next dae:
>
> # min tf
> # dx/dt = v
> # dv/dt = u - R*v^2
> # x(0)=0; x(tf)=L
> # v(0)=0; v(tf)=0
> # -3 <= u <= 1 (engine constraint)
> #
> # {v <= 7m/s ===> u < 1
> # u <= { (electric car constraint)
> # {v > 7m/s ===> u < 1*7/v
> #
> # -1.5 <= dv/dt <= 0.8 (comfort constraint -> smooth driving)
> # -0.5 <= d2v/dt2 <= 0.5 (comfort constraint -> jerk)
> # v <= Vmax (40 kmh[0-500m] + 25 kmh(500-1000m])
>
>
> As you can see, the acceleration provided by the electric engine (the only control variable, by the way) must be modelled as a piecewise equation, because it is define by constant acceleration until reaching a specific speed, and then by a constant power hyperbola depending of the vehicle speed (a state variable). Something close happens with the maximum allowed speed constraint, it is a piesewise constraint depending of the distance run by the vehicle (another state variable)
>
> I could model that easily in AMPL, but I would like to migrate to an open source library, so I first tried Pyomo, but it does not work due that this kind of constraints are not allowed by it, due that constrain are not defined as callbacks that are called by the solver in every iteration, but as a container filler called once at model creation, so I wonder if I could use Ipopt c++ interface directly.
>
> 1) If so, I have not found anything even close to this in the examples repository, could someone show me how to do it using some code example?
>
> 2) Does retaping be used for solving this issue?
>
> Thanks in advance,
> Pablo
>
>
>
>
>
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__list.coin-2Dor.org_mailman_listinfo_ipopt&d=CwICAg&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=BRcuJnQr5NAzU29t80hk2rsLc4vrlRySBDabuq0O1ZI&m=arLtmvhpMuqcUH6kaIaYIHumU0cnt57gzQ5mQTW0hCY&s=DAnqOTM51atKRtNKHS1sYIv_pznNMuDPYWcrFnGuFqM&e=
>
--
http://www.gams.com/~stefan
More information about the Ipopt
mailing list