Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing custom variable selection method using the CPLEX Python API

Tags:

python

cplex

I want to implement a custom variable selection heuristic for solving an MLP using the CPLEX Python API.

Unfortunately, I cannot find any examples or documentation for this.

Ist this actually possible using the CPLEX Python API, or do I need to use C++?

Can I achieve this using the BranchCallback [1]?

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

like image 752
Christopher Avatar asked Feb 26 '26 14:02

Christopher


1 Answers

The functionality of the 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 (aka, the GIL) in Python, however.

The admipex1.py, and admipex3.py Python examples demonstrate how to use the BranchCallback class and are included with CPLEX. For the corresponding C++ examples, see iloadmipex1.cpp and iloadmipex3.cpp.

like image 120
rkersh Avatar answered Feb 28 '26 02:02

rkersh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!