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
Topic

Re: Error: Label constraint
20121114T16:49:12ZThis is the accepted answer. This is the accepted answer.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; } }