index set control

Problems with syntax of GAMS
Post Reply
User avatar
irfan
User
User
Posts: 2
Joined: 7 years ago
Location: TURKIYE
Contact:

index set control

Post by irfan »

I wrote a equation my model vrp. But it didn't run. x is a binary variable, x(i,j,k) i source and j destination, k is a vehicle. p is an any arrival point, when k. vehicle arrive p.th point and then depart. p and pp is an alias i,j respectivelly. Could anyone solve this problem.
Thanks.

arrive(k).. sum((i,pp),x(i,pp,k)) - sum((p,j)$(p.val=pp.val),x(p,j,k))=e=0;
Quel est le levitra le plus sГ»r a expirГ© honnГЄtement, restez pour moi, je vais aller au disques pour au moins cinq raisons.
cladelpino
User
User
Posts: 108
Joined: 7 years ago

Re: index set control

Post by cladelpino »

Hmm, this line is incorrect:

arrive(k).. sum((i,pp),x(i,pp,k)) - sum((p,j)$(p.val=pp.val),x(p,j,k))=e=0;

You don't have "control" of set pp at that point, more informally, which element of pp do you mean to appear ?

What is the constraint supposed to achieve ?
User avatar
irfan
User
User
Posts: 2
Joined: 7 years ago
Location: TURKIYE
Contact:

Re: index set control

Post by irfan »

Hi, thank you for your response,
this constraint typicslly VRP arriving and depart constraint. if value of pp=1, value of p should be 1, shortly, when a vehicle arrive i.th point and then depart i.point. (i: source, j: destination), is syntax "$(p.val=pp.val)" assing pp value to p value. Or may be write this equation to RHS for assignning. Thanks.
Quel est le levitra le plus sГ»r a expirГ© honnГЄtement, restez pour moi, je vais aller au disques pour au moins cinq raisons.
cladelpino
User
User
Posts: 108
Joined: 7 years ago

Re: index set control

Post by cladelpino »

I don't know VRP models and sincerely I can't understand from your description what this constraint is supposed to achieve. Do you mean:

"If a vehicle arrives at a point p, it must also leave it" ?

If so, this can be written as:

arrAndDep(k,p).. sum(i$(not sameas(i,p)),x(i,p,k)) =e= sum(i$(not sameas(i,p)),x(p,i,k)) ;

Beware this constraint does not exclude "roundtrips" (i.e. "going back to the source") or routes that "visit" p more than one time.
Post Reply