4

I've been using GEKKO successfully for a variety of problems but one thing I haven't been able to pin down is what the limits are in terms of non-linear terms in objective functions or constraints. I've found that some non-linear terms are tolerated, e.g.

m.Obj(sum(x * values) / sum(x))

seems to work fine, however

m.Obj(sum(x * values + x ** 2 * other_values) / sum(x))

seems to be unsolvable. Is there any documentation about the limits of GEKKO to handle certain forms of non-linearities that might help me reformat my problem?

1 Answers1

1

Model building functions are listed in the Gekko documentation and include any nonlinear function that can be mathematically expressed with continuous first and second derivatives. Gekko gives the problem to a solver to attempt a solution. Sometimes the solver (IPOPT, BPOPT, APOPT) identifies the problem as infeasible or fails to find a solution. This doesn't mean that Gekko can't use these functions, only that a numerical solution was not found. You can try switching solvers with m.options.SOLVER=1. You may also need to use more efficient versions of the functions such as the Gekko m.sum() instead of the Python sum() function.

m.Minimize(m.sum(x * values + x ** 2 * other_values) / m.sum(x))

Certain solvers such as a APOPT also allow mixed integer problems. Differential and algebraic equations are also solvable with Gekko. There is more information in the documentation on switching solving modes with IMODE. There is a preview of applications with the 18 example applications.

John Hedengren
  • 12,068
  • 1
  • 21
  • 25