Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

When using GEKKO and APOPT solver with integer=True to estimate time-varying variables, the solution may be unstable and not accurate due to the integer constraint. To solve this issue, follow these steps:

  1. Change the solver to IPOPT or BPOPT. These solvers do not require integer=True and can handle time-varying variables more effectively.

  2. If you must use APOPT solver, try reducing the time horizon and/or increasing the number of time points to improve the accuracy of the solution.

  3. Use a warm start to the optimization, which means using the solution from the previous time point as the initial guess for the next time point. This approach can improve the stability and accuracy of the solution.

  4. Change the objective function to penalize large changes in the time-varying variables across time points. This approach can help to smooth out the solution and improve stability.

  5. Consider using different constraints or objectives that do not require the use of the integer=True option, such as a mixed-integer linear programming (MILP) formulation or a piecewise-continuous optimization. These approaches can be more suitable for time-varying variables.