Why can’t I increase or subtract sets in binary variable? I shared my problem below to be more descriptive.
I have defined x(i,j,t) as binary variable in my model. I want to write x(i,j,t-1) in the constraints section but I get an error. some part of my model is below:
binary variable x(i,j,t) if cell (i.j) is visited at t’th move of AGV;
equations
c3(i,j)… sum(t,x(i,j,t+1)) =e= 1;
I also defined v(m) and h(m) parameters in my model, I want to bring the values in these parameters to x(i,j,t) values, but I couldn’t write them. You can see the part I want to write below.
sets
i /1*10/
j /1*10/
m /1*12/
t /0*100/;
parameters
v(m) coordinate i vaalue of machine m
/
1 1
2 6
3 2
4 2
5 2
6 8
7 4
8 7
9 3
10 3
11 3
12 8
/
h(m) coordinate j vaalue of machine m
/
1 10
2 1
3 2
4 10
5 9
6 3
7 5
8 1
9 7
10 8
11 8
12 8
/;
[b]binary variable [/b]x(i,j,t) if cell (i.j) is visited at t'th move of AGV;
c1(m).. sum(t,x(v(m),h(m),t)) =e= 1;
how can i write constraint c1?
Thanks for your help
[b]all model:[/b]
sets
i /1*10/
j /1*10/
m /1*12/
t /0*100/;
parameters
v(m) coordinate i vaalue of machine m
/
1 1
2 6
3 2
4 2
5 2
6 8
7 4
8 7
9 3
10 3
11 3
12 8
/
h(m) coordinate j vaalue of machine m
/
1 10
2 1
3 2
4 10
5 9
6 3
7 5
8 1
9 7
10 8
11 8
12 8
/;
variable Z;
binary variable x(i,j,t) if cell (i.j) is visited at t'th move of AGV;
positive variables
bi(t)
bj(t)
;
equations
obj
c1(m) all mach.s are visited once
c2(t) AGV is at one cell at one time
c3(i,j) No cell is visited twice
c4(t) AGV can only move to adjacent squares
c5 AGV start at cell(10-5)
c6 AGV ends at cell S (10-5)
c7(t)
c8(t);
c1(m).. sum(t,x(v(m),h(m),t)) =e= 1;
c2(t).. sum(i,sum(j,x(i,j,t))) =e= 1;
c3(i,j).. sum(t,x(i,j,t+1)) =e= 1;
c4(t).. x(bi(t)-1,bj(t),t+1)+ x(bi(t)+1,bj(t),t+1)+x(bi(t),bj(t)-1,t+1)+x(bi(t),bj(t)+1,t+1)=e=1;
c5.. x('10','5','0')=e=1;
c6.. sum(t,x('10','5',t) * t)=g=35;
c7(t).. bi(t) =e= sum(i,sum(j,i*x(i,j,t)));
c8(t).. bj(t) =e= sum(i,sum(j,j*x(i,j,t)));
obj.. Z =e= sum(t,x('10','5',t)*t.l);
model s1 /all/;
option optcr=0;
solve s1 using MINLP min Z;