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
This topic has been locked.
1 reply
Latest Post
 20121114T16:49:12Z by SystemAdmin
ACCEPTED ANSWER
Pinned topic Error: Label constraint
20121114T16:01:41Z

Answered question
This question has been answered.
Unanswered question
This question has not been answered yet.
Updated on 20121114T16:49:12Z at 20121114T16:49:12Z by SystemAdmin

ACCEPTED ANSWER
Re: Error: Label constraint
20121114T16:49:12Z in response to SystemAdminAccording 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; } }