I want to have a decision variable over a set. However, I want that variable to be decided every other element of the set, and the other value for the decision variable be the value of the previous element. i.e.
Set Y /1*6/;
Set Y1 /1,3,5/;
Set Y2 /2,4,6/;
Variable a(Y);
Now, I want a(Y1) be the decision variable, and a(Y2) be equal to a(Y1), i.e.
a(‘2’) = a(‘1’)
a(‘4’) = a(‘3’)
a(‘6’) = a(‘5’)
Any ideas how I could do this?

Not sure what the challenge is. Here would be my solution:

Set Y /1*6/;
Set Y1(Y), Y2(Y);
Y1(Y) = mod(ord(Y),2)=1;
Y2(Y) = not Y1(Y);
display Y1,Y2;
Variable a(Y), obj;
equation equal(Y); equal(Y1(Y)).. a(Y) =e= a(Y+1);
equation dummy; dummy.. obj =e= 0;
model m /all/;
m.limrow=10;
solve m min obj us lp;

The relevant part in the listing looks as follows:

---- 5 SET Y1
1, 3, 5
---- 5 SET Y2
2, 4, 6
Equation Listing SOLVE m Using LP From line 13
---- equal =E=
equal(1).. a(1) - a(2) =E= 0 ; (LHS = 0)
equal(3).. a(3) - a(4) =E= 0 ; (LHS = 0)
equal(5).. a(5) - a(6) =E= 0 ; (LHS = 0)