Issue when running Gekko MPC applications with APOPT solver instead of IPOPT

Viewed 164

I'm a new GEKKO user, and I've recently starting making an MPC application that deals with a nonlinear furnace model. I'm currently testing the application using the Spyder IDE.

I want to use it on a linux system and be able to run the code locally on my own computer, so I can't currently use the standard IPOPT solver. I'm currently trying the APOPT and BPOPT solvers as alternatives (using m.options.SOLVER = 1). I tested the model previously in IPOPT and it was able to run without issue.

When I run the code with my current APOPT solver enabled, the solver is able to find a successful solution for the first initial steps, but eventually is unable to find a feasible solution.

Here is an example of the solver output:

enter image description here

The immediate thing that stands out to me is that the model currently has negative degrees of freedom and is probably over-specified.

I've been looking over the formulations for APOPT vs. IPOPT solvers, but I'm just looking to see if anyone knows if this is specifically the reason the solver cannot find a solution as it could in previous iterations, and why the model was able to be successfully run with an IPOPT solver.

Thanks for the help!

1 Answers

The negative degree of freedom issue is likely because you have inequality constraints in your problem. Before solving the problem, gekko doesn't know if those constraints will be active so it does the degree of freedom analysis assuming that all inequality constraints are active. One thing that you can look at is the infeasiblities.txt file that will tell you what constraint is infeasible. Your problem converged to 1.6e-7 so it doesn't look like the solver reports an infeasible solution because it is lost far from the correct solution. Another thing to try is to catch errors with remote=True and try the IPOPT solver if it is unsuccessful such as:

try:
   m.options.SOLVER = 1
   m.solve()
except:
   m.options.SOLVER = 3
   m.solve()
   print('IPOPT solved the problem when APOPT failed')

I have a version of the Linux executable for local solve but the distribution size is undesirably large to include with pip install gekko. I recommend that you first try to find the source of the infeasible solution and then if IPOPT if working better, I can get you the needed local executable with IPOPT.

Related