-1

How can I start with a specific city under a set of cities, rather than using x[i,j] I want to write such constraint x[1,2] + x[2,5] = 1

Moreover, how can I start from i=2, j=2 rather than start with i,j =1

Thanks, Haidar

Haidar
  • 1
  • 1
  • 1
    It's not clear what you're asking here. Can you please edit your question to clarify what you're trying to do? – GB supports the mod strike Dec 05 '20 at 10:44
  • I mean if I have such sets: set S; set L; S=1,..s L=1,....l. Here in my constraint, I do not want to use the whole set. Only for example s= 2 and l= 3 or I want to start from s= 2,...,s with excluding s =1. How can I do that with Ampl? – Haidar Dec 06 '20 at 08:10

1 Answers1

0

I want to write such constraint x[1,2] + x[2,5] = 1

s.t. c1: x[1,2]+x[2,5]=1;

how can I start from i=2, j=2 rather than start with i,j =1

Define index sets that don't have 1 in them. For instance, if you have

set S := 1..s;

then you could either do:

set S_2 := 2..s;

or:

set S_2 := S diff {2};

and then create a constraint indexed on S_2.