Tit*_*uah 4 optimization nonlinear-optimization mixed-integer-programming gekko
我有几个关于 APOPT 如何解决 MINLP 的问题。
APOPT 是一种使用分支定界的主动集顺序二次规划 (SQP) 求解器。APOPT 使用热启动方法来加速连续的非线性编程 (NLP) 解决方案。Wikipedia、APMonitor 文档和APOPT.com提供了有关 APOPT 的更多信息。2013 年 INFORMS 演示文稿和 2014 年 APMonitor CACE 论文中提供了基准信息。
\n\n这是在获取包后使用 Python Gekko 解决的示例 MINLP 问题pip install gekko
from gekko import GEKKO\nm = GEKKO() # Initialize gekko\nm.options.SOLVER=1  # APOPT is an MINLP solver\n\n# optional solver settings with APOPT\nm.solver_options = [\'minlp_maximum_iterations 500\', \\\n                    # minlp iterations with integer solution\n                    \'minlp_max_iter_with_int_sol 10\', \\\n                    # treat minlp as nlp\n                    \'minlp_as_nlp 0\', \\\n                    # nlp sub-problem max iterations\n                    \'nlp_maximum_iterations 50\', \\\n                    # 1 = depth first, 2 = breadth first\n                    \'minlp_branch_method 1\', \\\n                    # maximum deviation from whole number\n                    \'minlp_integer_tol 0.05\', \\\n                    # covergence tolerance\n                    \'minlp_gap_tol 0.01\']\n# Initialize variables\nx1 = m.Var(value=1,lb=1,ub=5)\nx2 = m.Var(value=5,lb=1,ub=5)\n# Integer constraints for x3 and x4\nx3 = m.Var(value=5,lb=1,ub=5,integer=True)\nx4 = m.Var(value=1,lb=1,ub=5,integer=True)\nm.Equation(x1*x2*x3*x4>=25)\nm.Equation(x1**2+x2**2+x3**2+x4**2==40)\nm.Obj(x1*x4*(x1+x2+x3)+x3) # Objective\nm.solve(disp=False) # Solve\nprint(\'x1: \' + str(x1.value))\nprint(\'x2: \' + str(x2.value))\nprint(\'x3: \' + str(x3.value))\nprint(\'x4: \' + str(x4.value))\nprint(\'Objective: \' + str(m.options.objfcnval))\n迭代摘要提供了有关寻找解决方案的分支定界过程的更多信息。
\n\n ----------------------------------------------\n Steady State Optimization with APOPT Solver\n ----------------------------------------------\nIter:     1 I:  0 Tm:      0.00 NLPi:    7 Dpth:    0 Lvs:    3 Obj:  1.70E+01 Gap:       NaN\n--Integer Solution:   1.75E+01 Lowest Leaf:   1.70E+01 Gap:   3.00E-02\nIter:     2 I:  0 Tm:      0.00 NLPi:    5 Dpth:    1 Lvs:    2 Obj:  1.75E+01 Gap:  3.00E-02\nIter:     3 I:  0 Tm:      0.00 NLPi:    6 Dpth:    1 Lvs:    2 Obj:  1.75E+01 Gap:  3.00E-02\n--Integer Solution:   1.75E+01 Lowest Leaf:   1.70E+01 Gap:   3.00E-02\nIter:     4 I:  0 Tm:      0.00 NLPi:    6 Dpth:    2 Lvs:    1 Obj:  2.59E+01 Gap:  3.00E-02\nIter:     5 I:  0 Tm:      0.00 NLPi:    5 Dpth:    1 Lvs:    0 Obj:  2.15E+01 Gap:  3.00E-02\n No additional trial points, returning the best integer solution\n Successful solution\n\n ---------------------------------------------------\n Solver         :  APOPT (v1.0)\n Solution time  :   1.609999999345746E-002 sec\n Objective      :    17.5322673012512     \n Successful solution\n ---------------------------------------------------\n\nx1: [1.3589086474]\nx2: [4.5992789966]\nx3: [4.0]\nx4: [1.0]\nObjective: 17.532267301\n