Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Error: Label constraint

    Posted 11/14/12 11:02 AM

    Originally posted by: SystemAdmin


    Hello together,

    I don´t understand why I get the error for my constraint: " Name ``Name of constraint´´ already defined".

    The modell looks like:

    //Sets used as indexes
    int lastClient=...;
    range C= 1..lastClient;

    //Parameters:
    int L[C] =...; //lot size
    int P[C] = ...; //price per lot
    int T[C]=...; //transportation cost
    int B=...; //maximal capacity

    //Decision Variable
    dvar float+ X[C];

    //Expression
    dexpr float income = sum (c in C) X[c]*(P[c]-T[c]*L[c]);
    //Objective Function

    maximize income;

    constraint ctCapacity;

    subject to {

    ctCapacity: sum(c in C) X[c]*L[c]<= B; --> here I get the error like I explained above.

    }

    I hope you can help me, thank you.

    regards,
    Markus
    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: Error: Label constraint

    Posted 11/14/12 11:49 AM

    Originally posted by: SystemAdmin


    According to the reference documentation you can use the 'constraint' keyword only with indexed labels. The following is an extended version of the code snippet in the reference documentation that works without trouble:
    
    range Products = 1..2; range Cities = 1..3;   dvar float+ x[Products][Cities];   constraint ct[Products][Cities];   minimize sum(p in Products,c in Cities) x[p][c];   subject to 
    { forall(p in Products,c in Cities) 
    { ct[p][c]: x[p][c] >= 0; 
    } 
    }
    

    #DecisionOptimization
    #MathematicalProgramming-General