-
when I run this code
I get:
Why? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Converging to a point of infeasibility with Ipopt typically is caused by one of two things:
I suspect in this case, the problem is 2. It is important to provide a good initial guess for all variables if possible to help Ipopt converge. I would recommend simulating your ODE system with a fixed control policy and then use those values to initialize the optimization model. |
Beta Was this translation helpful? Give feedback.
-
Hi @chelseas, I took a closer look and found that the problem is that your problem is infeasible. The culprit is the battery ODE: using InfiniteOpt, Ipopt
m = InfiniteModel(Ipopt.Optimizer)
@infinite_parameter(m, t in [0,60], num_supports = 100)
@variable(m, b, Infinite(t))
@constraint(m, b(0) == 100)
@constraint(m, ∂(b, t) == -.25*t)
@constraint(m, b >= 0) # this constraint makes it infeasible
optimize!(m) Here, the ODE for using InfiniteOpt, Ipopt
m = InfiniteModel(Ipopt.Optimizer)
@infinite_parameter(m, t in [0,60], num_supports = 100)
@variable(m, b, Infinite(t))
@constraint(m, b(0) == 100)
@constraint(m, ∂(b, t) == -.25*t)
optimize!(m) Note that he final value of Moreover, as modeled your |
Beta Was this translation helpful? Give feedback.
Hi @chelseas, I took a closer look and found that the problem is that your problem is infeasible. The culprit is the battery ODE:
Here, the ODE for
b
has no degrees of freedom and is totally determined with the initial condition. It's solution must be negative after a certain time. If we remove that constraint it works: