Decision Optimization

Expand all | Collapse all

how to print the name of the active constraint in OPL

  • 1.  how to print the name of the active constraint in OPL

    Posted Wed August 11, 2021 01:18 PM
    Hi,

    I am solving a small-scale linear programming model in OPL. Suppose I name my constraints as c_1,c_2, ..., c_k. I would like to print the name of the active constraints after solving my model. How can I do that?

    ------------------------------
    S Y
    ------------------------------


  • 2.  RE: how to print the name of the active constraint in OPL

    Posted Mon August 16, 2021 04:01 AM
    What do you mean by "active constraint" ?

    Usually all constraints defined in the model are "active",  that is they are part of the model and are enforced by the engine, as defined in the "subject to" section.


    ------------------------------
    Frederic Delhoume
    ------------------------------



  • 3.  RE: how to print the name of the active constraint in OPL

    Posted Mon August 16, 2021 05:06 AM
    You can use scripting to display constraints properties

    execute {
     writeln(c_1.dual);
     writeln(c_1.slack);


    or debug mode



    ------------------------------
    Frederic Delhoume
    ------------------------------



  • 4.  RE: how to print the name of the active constraint in OPL

    Posted Mon August 16, 2021 12:37 PM
    Hi,

    I mean binding/tights constraintswhen I say active constraints. Sorry for the confusion.

    ------------------------------
    S Y
    ------------------------------