Closed wingmanzz closed 5 years ago
All solvers report that they fail to find a solution to this problem with IPOPT reporting that the problem may be infeasible. Infeasible means that the problem is over-specified and all of the constraints cannot be simultaneously satisfied.
EXIT: Converged to a point of local infeasibility. Problem may be infeasible.
An error occured.
The error code is 2
---------------------------------------------------
Solver : IPOPT (v3.12)
Solution time : 2.610000000277068E-002 sec
Objective : -78.5577369813809
Unsuccessful with error code 0
---------------------------------------------------
I recommend that you check m.options.APPSTATUS
(for Gekko) when the solver exits to make sure it is a good solution (=1) or a bad solution (=0). Here is additional information on the APPSTATUS parameter. You can retrieve 'infeasibilities.txt' from your local run directory to help identify the infeasible equation(s).
oh go it. I was under the impression GEKKO threw an exception if the solution was infeasible. Not sure where I got that from. Thanks.
It should throw an exception if it is infeasible. Could you post the original Gekko code instead of the APM model if this is still an issue?
@APMonitor It doesn't throw an exception because the results can still be useful (eg plotting to diagnose the problem). Scipy.optimize also does not throw exceptions on unsuccessful optimizations. I still think we should leave it to the user to read the solver output, check the status attribute and/or analyze the results. If you really want another indication, a Warning should suffice.
@loganbeal Thanks for the insights. I agree that infeasible solutions can useful. I like the idea of using a warning. Otherwise many will think a solution is successful. I've been misled many times by Scipy.optimize returning a solution with no indication that it is a bad solution. In each case, it took some troubleshoot to realize that it was not solved. The raise Warning
seems to block the program from finishing. If we do implement a warning, any objections to using the warnings
package?
import warnings
warnings.warn("Infeasible solution")
I'll create a new Issue (Feature Request) to add a warning message for failed solutions.
Below is an APM file
and here is the result:
{ "time" : [0.00], "p1" : [ 2.0000000000E+02], "p2" : [ 1.0000000000E+02], "p3" : [ 5.0000000000E+01], "p4" : [ 1.4000000000E+00], "p5" : [ 6.1000000000E+00], "v1" : [ 5.0000000000E+01], "v2" : [ 1.1475409847E+01], "v3" : [ 3.0434782609E+01], "v4" : [ 7.0000000000E+01], "v5" : [ 7.0000000065E+01], "v6" : [ 2.0000000000E+01], "v7" : [ 5.8524590219E+01], "slk_1" : [ 1.4507972462E-24], "slk_2" : [ 9.1279503106E-09], "slk_3" : [ 1.3852459015E+02], "slk_4" : [ 5.0000000000E+01], "slk_5" : [ 8.8524590153E+01], "slk_11" : [ 7.8524590219E+01], "slk_12" : [ 1.0956521746E+02], "slk_13" : [ 0.00 ], "slk_14" : [ 6.5440496894E-08] }
Notice the inequality for v2 (v2 >= p3, where p3 = 50). The solution comes up with v2=11.47. Why is this equation not honored? Did I setup the model incorrectly? It seems to happen all the time.