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...

КОМЕНТАРІ • 15

  • @harryodendaal345
    @harryodendaal345 3 роки тому +3

    can you use the simplex algorithm with gekko?

  • @marcosleno3561
    @marcosleno3561 2 роки тому +1

    Thank you! Thank you! Thank you! Thank you! Thank you! Thank you! ... Thank you!

    • @apm
      @apm  2 роки тому +1

      You are welcome! Check out more MINLP examples in the Gekko documentation and on the Design Optimization course website: apmonitor.com/me575

  • @federicosartore6018
    @federicosartore6018 9 місяців тому +1

    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

    • @apm
      @apm  9 місяців тому

      Could you post the problem to StackOverflow with a Minimal Complete example that demonstrates the issue? stackoverflow.com/questions/tagged/gekko

  • @akimtsvigun8783
    @akimtsvigun8783 4 роки тому +2

    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!

    • @apm
      @apm  4 роки тому +1

      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

  • @rtv1196
    @rtv1196 9 місяців тому +1

    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?

    • @rtv1196
      @rtv1196 9 місяців тому

      By the way, if I make a lot of variables as sos1 it significantly increases number of degrees of freedom and solution failed.

    • @apm
      @apm  9 місяців тому

      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.

  • @elias6160
    @elias6160 4 роки тому +1

    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

    • @apm
      @apm  4 роки тому +4

      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

  • @2010aurnob
    @2010aurnob 3 роки тому +1

    Dr. Hedengren, is there any way to plot errors in a GEKKO modeling plot?

    • @apm
      @apm  3 роки тому +2

      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.

    • @2010aurnob
      @2010aurnob 3 роки тому

      @@apm Thank you