MIP and conditional constraints

I want to add new contsraints to the following gams code , however i can not integrate these constraints, anyone can help me. I attached constraints.
Especially when 𝑘∈{2,3,17,18,20,25}, how can i specify this?

options limrow=1000,limcol=1000,iterlim=100000000,reslim=36000,optcr=0 ;
set i cities /1*25/;
alias (i,k);
alias (i,j);
alias (i,l);
scalar p //;
scalar q //;
scalar alfa //;

Table d(i,j) distances

Parameter O(i) /

binary variables x(i,j),
z (i,j);
positive variables f(i,j,k);
free variables amac;
…;
objective…amac=e=sum((i,k),d(i,k)*O(i)x(i,k))+sum((i,j,k),alfad(i,j)*f(i,j,k))+sum((i,k),d(k,i)*O(i)*x(i,k));
constraint1(i)…sum((j),x(i,j))=e=1;
constraint2(i,j)…x(i,j)=l=x(j,j);
constraint3(i,j)(ord(i) lt ord(j))..z(i,j)=l=x(i,i); constraint4(i,j)(ord(i) lt ord(j))…z(i,j)=l=x(j,j);
constraint5…sum(j,x(j,j))=e=p;
.
.
.
constraint8(i,j,k)$(ord(i) lt ord(j))…f(i,j,k)+f(j,i,k)=l=O(k)*z(i,j);
model transport /all/ ;
option threads=1;
option mip=cplex
solve transport using MIP minimizing amac;
transport.optfile=1;
display amac.l,f.l, x.l, z.l;
const.png

Hi

You can define a substet of i with the cities to sum over:

set ks subset of cities /2,3,17,18,20,25/;

and then write your equations using ks instead of k:

equation 
	atleastonek;

atleastonek..
      sum(ks, X(ks,ks)) =GE= 1;

Same for the two other constraints.

Cheers
Renger

First of all, thank you very much for your answer. However, when i try this method, i take domain violation for set error.

Hi
Just show the code…
Renger

I fixed error. But the result is infeasible due to the 5th constraint.

options limrow=1000,limcol=1000,iterlim=100000000,reslim=36000,optcr=0 ;
set i cities /1*25/;
set ks1 subset of cities /2,3,17,18,20,25/;
set ks2 subset of cities/4,5,6,9,21/;
set ks3 subset of cities/12,14,22,23/;
alias (i,k);
alias (i,j);
alias (i,l);
scalar p /5/;
scalar q /4/;
scalar alfa /0.8/;

Table d(i,j) distances

Parameter O(i) /

binary variables x(i,j),
z (i,j);
positive variables f(i,j,k);
free variables amac;
Equations
objective
constraint1
constraint2
constraint3
constraint4
constraint5
constraint6
constraint7
constraint8
atleastonek1
atleastonek2
atleastonek3;
objective…amac=e=sum((i,k),d(i,k)*O(i)x(i,k))+sum((i,j,k),alfad(i,j)*f(i,j,k))+sum((i,k),d(k,i)*O(i)*x(i,k));
constraint1(i)…sum((j),x(i,j))=e=1;
constraint2(i,j)…x(i,j)=l=x(j,j);
constraint3(i,j)(ord(i) lt ord(j))..z(i,j)=l=x(i,i); constraint4(i,j)(ord(i) lt ord(j))…z(i,j)=l=x(j,j);
constraint5…sum(j,x(j,j))=e=p;
constraint6…sum((i,j)(ord(i) lt ord(j)),z(i,j))=e=q; constraint7(i,k)..sum(j(ord(i) ne ord(j)),f(j,i,k))+O(k)*x(k,i) =e= sum(j$(ord(i) ne ord(j)),f(i,j,k))+ sum((l),w(k,l)*x(l,i));
constraint8(i,j,k)(ord(i) lt ord(j))..f(i,j,k)+f(j,i,k)=l=O(k)*z(i,j); atleastonek1(ks1)..sum(j(ord(j) eq ord(ks1)), x(j,j)) =g= 1;
atleastonek2(ks2)…sum(j$(ord(j) eq ord(ks2)), x(j,j)) =g= 1;
atleastonek3(ks3)…sum(j$(ord(j) eq ord(ks3)), x(j,j)) =g= 1;
model transport /all/ ;
option threads=1;
option mip=cplex
solve transport using MIP minimizing amac;
transport.optfile=1;
display amac.l,f.l, x.l, z.l;