Decision Optimization

Expand all | Collapse all

Difficulty with Setting Parameters in APIs

  • 1.  Difficulty with Setting Parameters in APIs

    Posted Mon January 25, 2021 05:53 AM
      |   view attached
    Hello everyone, 
    I need small help for setting CPLEX parameters. I know  it is explained in the documentation, but independent from which parameter I set, I have some difficulties to set them  on different APIs. For example, in the following picture, you see, the setting MIP emphasis. What is the exact line to set it in C++ and  Python  ? Is there any specific formula that I can implement for all APIs to set parameters?  

    Thank you so much in advance

    ------------------------------
    milena kafka
    ------------------------------


  • 2.  RE: Difficulty with Setting Parameters in APIs

    Posted Tue January 26, 2021 09:41 AM
    Hello,

    Answer for P{ython API: assuming `model` is a Cplex instance,
    model.parameters.emphasis.mip returns a Parameter object, with a `set()` method to modify.

    For example (taken from the `etsp.py` sample in Cplex Python samples), setting hidden  feasibility (=4) as mip emphasis reads:

    model.parameters.emphasis.mip.set(4)

    If you're using DOcplex, assuming `model` is an instance of `docplex.mp.mode.Model` , a simple assignment is enough:

    model.parameters.emphasis.mip= 4


      Hope this helps.

         Philippe

    ------------------------------
    Philippe Couronne
    ------------------------------