Hi Mathias

You basic decision is not x(i,t) but rather for each i when to start. Once you have decided this everything has been decided. You can use something like this:

binary variable x(i,t), xstart(i,t), xstop(i,t);

equation onestart(i)

nolatestart(i)

startstop(i,t)

xdef(i,t);

onestart(i) … sum(t$(ord(t) le card(t)+1-c(i)), xstart(i,t)) =E= 1;

nolatestart(i) … sum(t$(ord(t) gt card(t)+1-c(i)), xstart(i,t)) =E= 0;

startstop(i,t) … xstop(i,t) =E= xstart(i,t-c(i));

## xdef(i,t) … x(i,t) =E= x(i,t-1) + xstart(i,t) - xstop(i,t);

The first equation makes sure that you start exactly once, the second that you do not start so late that you cannot have c(i) consecutive x, the third defines when you stop, namely after c(i) periods, and x is then just defined as previous x adjusted for start and stop. The model may appear larger, but the number of independent decisions is actually smaller.

Good luck

Arne

\

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Mathias

Sent: Tuesday, September 04, 2012 12:51 PM

To: gamsworld@googlegroups.com

Subject: consecutive assignement within an ordered set

Hello everyone!

I have following problem within a mip i am actually modelling for my master thesis.

I have an

ordered set with periods like t /1*100/

another set i /…/

and

a binary variable x(i,t)

as well i have a parameter c(i) which is integer and greater than zero and returns the value how often x(i,t) has to be assigned within the set problem for each i.

equation1(i)…

## sum(t, x(i,t)) =e= c(i);

The problem I can’t solve is, that x(i,t) should be assigned to “c(i)” (for example 3) consecutive periods t.Unfortunately I can’t manage it with the ord operator, because c(i) is different for each i.

I hope my explenation is not too confusing.

It would be amazing, if anyone could help me

Mathias

\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/der_jKpKG0AJ.

To post to this group, send email to gamsworld@googlegroups.com.

To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

–

To post to this group, send email to gamsworld@googlegroups.com.

To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.