使用 CPLEX Python API 编写自定义变量选择方法

Writing custom variable selection method using the CPLEX Python API

我想使用 CPLEX Python API 实现自定义变量选择启发式求解 MLP。

很遗憾,我找不到任何示例或文档。

这实际上可以使用 CPLEX Python API,还是我需要使用 C++?

我可以使用 BranchCallback [1] 实现吗?

[1] https://www.ibm.com/support/knowledgecenter/SSSA5P_12.5.0/ilog.odms.cplex.help/refpythoncplex/html/cplex.callbacks.BranchCallback-class.html

BranchCallback in the CPLEX Python API should be nearly identical to that of BranchCallbackI provided in the C++ API. Parallel callbacks are hindered by the global interpreter lock(又名 GIL)在 Python 中的功能。

admipex1.pyadmipex3.py Python 示例演示了如何使用 BranchCallback class 并且包含在 CPLEX 中。有关相应的 C++ 示例,请参阅 iloadmipex1.cppiloadmipex3.cpp