使用 PULP 设置 CPLEX 间隙

CPLEX gap setting with PULP

有人知道如何在从 PULP (python) 调用 CMD_CPLEX() 时为 CPLEX 求解器设置 epgap 参数吗?

我已经尝试了从文件夹中的选项文件到大量不同语法尝试的所有方法,例如:

prob.solve(CPLEX_CMD(options = ['epgap = 0.25']))

如有任何提示,我们将不胜感激!

您可能知道,CPLEX_CMD 求解器是 CPLEX interactive. To set parameters, you need to use the same syntax that you'd use within the interactive. So, to set the relative MIP gap tolerance 参数的包装器,您需要使用以下语法:

prob.solve(CPLEX_CMD(options=['set mip tolerances mipgap 0.25']))