简体   繁体   中英

How to obtain the total number of cuts in docplex?

I'm trying to obtain the total number of cuts from a solved docplex model, so basically the sum of the following output:

Implied bound cuts applied: 7 Flow cuts applied: 10 Mixed integer rounding cuts applied: 7 Zero-half cuts applied: 2 Lift and project cuts applied: 5 Gomory fractional cuts applied: 4

This is not yet directly provided by docplex, we'll keep this in mind for future versions. In the meantime you can use this code here:

https://github.com/PhilippeCouronne/docplex_contribs/blob/master/docplex_contribs/src/numcuts.py

Beware this uses non-documented classes and does not check that the model is actually a MIP. Anyway, it returns a dictionary of cut_name: number of cuts used, eg:

 {'cover': 88, 'GUB_cover': 9, 'flow_cover': 6, 'fractional': 5, 'MIR': 9, 'zero_half': 9, 'lift_and_project': 5}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM