Gekko - APMonitor在收敛具有线性分数目标函数的MINLP问题时遇到了困难?



Gekko - APMonitor优化套件无法解决优化问题。我试图求解最大a^Tx/b^Tx的约束条件为d<=c^Tx <=e,其中决策向量x=[x_1, x_2,…], x_n]为非负整数,向量a、b、c为正实数向量,常数d、e为正下界和上界。这个问题是可行的,因为我得到了一个可行的解目标被0取代。我想知道APMonitor是否能够解决线性分数目标问题。

谁有处理这类问题的经验?解决方案中是否有任何选项,我可以尝试打开来解决这个问题?我使用的选项如下:

from gekko import GEKKO
model = GEKKO() 
model.options.SOLVER=1 
model.solver_options = ['minlp_maximum_iterations 100', 
                        'minlp_max_iter_with_int_sol 10', 
                        'minlp_as_nlp 0', 
                        'nlp_maximum_iterations 50', 
                        'minlp_branch_method 1', 
                        'minlp_print_level 8',  
                        'minlp_integer_tol 0.05', 
                        'minlp_gap_tol 0.001']
model.solve(disp=True)

输出如下所示,其中求解器状态与APPSTATUS和APPINFO不一致。这可能是APMonitor报告问题。

apm 67.162.115.84_gk_model0 <br><pre> ----------------------------------------------- 
-----------------
APMonitor, Version 1.0.1
APMonitor Optimization Suite
----------------------------------------------------------------

--------- APM Model Size ------------
Each time step contains
Objects      :            7
Constants    :            0
Variables    :         5626
Intermediates:            0
Connections  :         4914
Equations    :         4913
Residuals    :         4913
Number of state variables:           5626
Number of total equations: -         4919
Number of slack variables: -            2
 ---------------------------------------
Degrees of freedom       :            705
----------------------------------------------
Steady State Optimization with APOPT Solver
----------------------------------------------
Iter:     1 I: -9 Tm:     75.50 NLPi:  251 Dpth:    0 Lvs:    0 Obj:  0.00E+00 Gap:       
 NaN
 Warning: no more possible trial points and no integer solution
 Maximum iterations
 ---------------------------------------------------
 Solver         :  APOPT (v1.0)
 Solution time  :    75.5581999999995      sec
 Objective      :                      NaN
 Unsuccessful with error code            0
 ---------------------------------------------------
 Creating file: infeasibilities.txt
 Use command apm_get(server,app,'infeasibilities.txt') to retrieve file
 @error: Solution Not Found
 Not successful
 Gekko Solvetime: 1.0 s

 #################################################
 APPINFO = 0  -  a successful solution
 APPSTATUS =1 - solver converges to a successful solution
 Solver status - Not successful, exception thrown
 decision variable =[0,0, ...,0].

为了使目标最大化,求解器将b的值最小化,使目标函数趋于+∞。尝试将b的下界设置为较小的数字,例如0.001,以防止无界解。从非零值(默认)开始也可以帮助找到解决方案。

b = model.Array(m.Var,n,value=1,lb=0.001)

另一个建议是设置b^Tx的下界约束,以防x也趋于零。

model.Equation(b@x>=0.01)

如果APOPT求解器不收敛于修改后的问题,则尝试使用NLP求解器(如内点法求解器IPOPT)初始化解。Gekko保留了一个解的解值,作为下一个解的初始猜测。

model.options.SOLVER=3
model.solve()
model.options.SOLVER=1
model.solver_options = ['minlp_maximum_iterations 100', 
                        'minlp_max_iter_with_int_sol 10', 
                        'minlp_as_nlp 0', 
                        'nlp_maximum_iterations 50', 
                        'minlp_branch_method 1', 
                        'minlp_print_level 8',  
                        'minlp_integer_tol 0.05', 
                        'minlp_gap_tol 0.001']
model.solve()

如果需要更具体的建议,请张贴一个完整的和最小的例子。

最新更新