I want to use my own Genetic Algorithm (GA) to solve a Mixed Integer problem:
https://mintoc.de/index.php/Batch_reactor
Can I incorporate my solving method in GEKKO?
something like...
m = GEKKO()
.
.
.
m.options.SOLVER = 'my_GA'
I want to use my own Genetic Algorithm (GA) to solve a Mixed Integer problem:
https://mintoc.de/index.php/Batch_reactor
Can I incorporate my solving method in GEKKO?
something like...
m = GEKKO()
.
.
.
m.options.SOLVER = 'my_GA'
GEKKO currently only supports gradient-based built-in solvers. If you are set on using a Genetic Algorithm (Chapter 6 for GA overview), you could run function evaluations with GEKKO to returns an objective value at different trial conditions. You would need to put an m.solve()
command inside a loop every new generation of the GA. In GEKKO, you would also need to use m.options.TIME_SHIFT=0
to not update the initial conditions. This would allow repeated evaluations as you change your design variables (e.g. T(t) from MintOC) to find the best objective function value (e.g. x2(tf) from MintOC).
m = GEKKO()
# define model
x2 = m.Var()
T = m.Param()
.
.
.
m.options.TIME_SHIFT=0
m.options.IMODE = 4 # or 7
# GA loop
for i in range(generations):
T.value = [values from GA]
m.solve()
obj = x2.value[-1] # objective
# additional GA steps to decide new T values
Here is some additional information from the documentation: SOLVER selects the solver to use in an attempt to find a solution. There are free solvers: 1: APOPT, 2: BPOPT, 3: IPOPT distributed with the public version of the software. There are additional solvers that are not included with the public version and require a commercial license. IPOPT is generally the best for problems with large numbers of degrees of freedom or when starting without a good initial guess. BPOPT has been found to be the best for systems biology applications. APOPT is generally the best when warm-starting from a prior solution or when the number of degrees of freedom (Number of Variables - Number of Equations) is less than 2000. APOPT is also the only solver that handles Mixed Integer problems. Use option 0 to compare all available solvers.
© 2022 - 2024 — McMap. All rights reserved.
GEKKO(remote=False)
? When setting this, APOPT is selected and I get the message "solver 3 not supported; using default solver: APOPT". If I have a local version of IPOPT, can I pass this to GEKKO somehow? – Brahmi