Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

Constraint labeling in sumation?

  • 1.  Constraint labeling in sumation?

    Posted Thu March 15, 2012 10:05 PM

    Originally posted by: Y9AX_Pooyan_Kazemian


    Hi,

    I describe My problem with an example. Suppose we want to write the following in CPLEX:

    Sum(i from 5 to 10) sum(j form 1 to i) x_ij <= 100

    The problematic part is the second summation that goes from 1 to i.

    In CPLEX I write:

    forall (i in 1..10 , j in 1..i) const: x[i][j]<=100;

    It returns the following error:

    “Constraint labeling not supported for dimensions with variable size, use named constraints instead.”

    There should be a way to write the summation when it’s dependent to the preceding summation. Any help is appreciated?

    Thanks,
    Pooyan
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Constraint labeling in sumation?

    Posted Fri March 16, 2012 09:06 AM
    Hi,

    in documentation

    IDE and OPL > Optimization Programming Language (OPL) > Language Reference Manual > OPL, the modeling language > Constraints > Constraint labels

    you can find an example:

    tuple RangeTuple
    {
        int i;
        int j;
        string k;
    };
    {RangeTuple} RT = {<1, 2, "bla">};
     
    {int} s={1,2};
     
    constraint rangeLabel[RT][s];
     
    minimize 1;
     
    subject to
    {
        forall(<p1, p2, p3> in RT)
            forall(i in p1..p2)
        rangeLabel[<p1,p2,p3>,i]:
         1 == 1;
    }
    


    Regards

    Alex
    #DecisionOptimization
    #OPLusingCPLEXOptimizer