Discrete Optimization in Python GEKKO
Вставка
- Опубліковано 5 вер 2024
- Discrete variables include binary (0 or 1), integer (-1, 0, 1, 2, 3,...), or general discrete values (1/4, 1/2, 1, 2). Python GEKKO optimizes a system of equations with continuous and integer values with the MINLP solver APOPT.
Source code (see #10): apmonitor.com/w...
can you use the simplex algorithm with gekko?
Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! ... Thank you!
You are welcome! Check out more MINLP examples in the Gekko documentation and on the Design Optimization course website: apmonitor.com/me575
Hello, I would like to use Gekko in MINLP. I have a quite complicated function to solve. I have an issue when it enters into the "solve()". Indeed it tells me that the value of the function is not integer, which makes no sense as the variables should be eventually integers, not the objective function. If i round the objective to the closest integer, it solves the problem. It finds feasible solutions but it never updates the objective value, which always stays the one of the initialized conditions, so I think it solves nothing, especially for the sped it does it with it's too fast given the complexity of the problem. Do you know what might be the problem ? Thank you
Could you post the problem to StackOverflow with a Minimal Complete example that demonstrates the issue? stackoverflow.com/questions/tagged/gekko
Hey! Just wanted to wonder whether it is possible in Gekko to set funciton value in a specified point. For instance, I need to set y(0) = 2 (it is possible via m.Var(2)) and y(2) = 3 (I have not found how I can do this). Thanks in advance!
Does this question on StackOverflow help? stackoverflow.com/questions/59234190/how-to-set-variable-value-at-x3-6-not-initial-condition-in-python-gekko/59234847
Thanks for great tutorials. Recently discovered GEKKO and I'm really impressed how capable it is.
Could you please tell, how can I constraint one or more of my integer variables to be equally spaced on grid with some step
If I try (where 20 - step):
m.Equation(x[10]%20)
I'm getting:
TypeError: unsupported operand type(s) for %: 'GKVariable' and 'int'
Is defining variable as sos1 the only way to do it?
By the way, if I make a lot of variables as sos1 it significantly increases number of degrees of freedom and solution failed.
Just multiply the integer variable by 20 to get 0, 20, 40, etc. if you would like help with specifics of the implementation, please post your best effort to stack overflow.
Hi !
In case of a diameter optimization how do you declare that the possible diameter are e.g. [1/4, 1/2 , 1 , 2 ] ?
Thanks in advance
You need to use an SOS1 constraint in discrete optimization as shown at the bottom of this page: apmonitor.com/wiki/index.php/Main/IntegerBinaryVariables
Dr. Hedengren, is there any way to plot errors in a GEKKO modeling plot?
It is most likely possible if you can extract the values. All Gekko variables are available with x.value if "x" is the variable name. An error such as a solver error can be retrieved with m.options.APPINFO.
@@apm Thank you