Topic
  • 4 replies
  • Latest Post - ‏2014-05-23T15:11:05Z by Vincent Lin
Vincent Lin
Vincent Lin
6 Posts

Pinned topic OPL Constraint Label

‏2014-05-21T21:41:21Z |

Is there a quick & easy way to force CPLEX to ignore all the constraint labels in an OPL file?

  • AlexFleischer
    AlexFleischer
    1206 Posts

    Re: OPL Constraint Label

    ‏2014-05-22T08:31:56Z  

    Hi,

    do you want those constraints to be taken into account by the optimization ?

    Or you want them not to be relaxed ?

    regards

  • Vincent Lin
    Vincent Lin
    6 Posts

    Re: OPL Constraint Label

    ‏2014-05-22T14:43:34Z  

    Hi,

    do you want those constraints to be taken into account by the optimization ?

    Or you want them not to be relaxed ?

    regards

    I want those constraints to be taken into account and I do not want them to be relaxed. Actually the model is constructed in the way that it is always feasible. I labeled the constraints in order to get the shadow prices. My understanding is that the constraint labels consume more memory and may affect the performance, so I would like to have an option to remove the labels.

  • AlexFleischer
    AlexFleischer
    1206 Posts

    Re: OPL Constraint Label

    ‏2014-05-23T09:30:12Z  

    I want those constraints to be taken into account and I do not want them to be relaxed. Actually the model is constructed in the way that it is always feasible. I labeled the constraints in order to get the shadow prices. My understanding is that the constraint labels consume more memory and may affect the performance, so I would like to have an option to remove the labels.

    Hi

    Ok then you can write your constraints like this

    forall(i in s)

    //label    ctLabel:

    x[i]<=2;

     

    and then by replacing all //label into /*label*/ or conversely you will activate or disactivate labels.

    regards

  • Vincent Lin
    Vincent Lin
    6 Posts

    Re: OPL Constraint Label

    ‏2014-05-23T15:11:05Z  

    Hi

    Ok then you can write your constraints like this

    forall(i in s)

    //label    ctLabel:

    x[i]<=2;

     

    and then by replacing all //label into /*label*/ or conversely you will activate or disactivate labels.

    regards

    Actually I am looking for a way to avoid the hard code, for example,

    int lableOn = ...;

    if(labelOn == 1){

    ctLabel:

    x <=2;

    }

    else{

    x<=2;

    }

    and then based on the input value of labelOn, the model is constructed with or without labels.

    Looks like there is no better way to do this?