time decomposition

12 views
Skip to first unread message

Taby

unread,
Jun 24, 2016, 12:06:43 PM6/24/16
to AMPL Modeling Language
Hello, I am working on a fix and optimize heuristic. I have a set of 6 Periods (T=6).  I am trying to unfix binary Variables for Periods 1-4 first and then from 3-6. My example doesn't need anymore periods but otherwise it would continue with periods 5-8, 7-10 and so on.
It seems that AMPL doesn't know that I am refering to Periods, because I get a syntax error.
Please help me

Thank you so much in advance
Taby

zeitdeko.PNG

Robert Fourer

unread,
Jun 25, 2016, 4:37:18 PM6/25/16
to am...@googlegroups.com
Since tau is a set, it does not make sense to write 1+tau*theta. That is why you are getting a syntax error. Instead you could write

param tau := 2;
set TAU := 1..tau;

and then to define the inner loop,

for {t in TAU} { ...

Bob Fourer
am...@googlegroups.com

=======

Taby

unread,
Jun 27, 2016, 11:55:35 AM6/27/16
to AMPL Modeling Language, 4...@ampl.com
Dear Bob Fourer, thank you for your response. I tryed your suggestion but I still have the same problem. I have to unfix 4 Periods each time and then choose the next 4 ones overlapping two of them.
This means that I want the loop to choose TAU=0 so that I get to unfix first periods 1 to 4 like this:
  t in 1+tau*theta..lamda+tau*theta
        1+ 0  *  2    ..   4      + 0* 2    =>  1..4
        1+ 1  *  2    ..   4      + 1* 2    =>  3..6
        1+ 2  *  2    ..   4      + 2* 2    =>  5..8
        1+ 3  *  2    ..   4      + 3* 2    =>  7..10
So that's why I putted the set TAU instead param tau at first. But either way work.
Thanks again in advance
Taby
Zeit 1.PNG

Robert Fourer

unread,
Jun 27, 2016, 6:50:50 PM6/27/16
to am...@googlegroups.com
You are seeing a different error message, due to the fact that "for {t in TAU} {..." now conflicts with "unfix {i in B, t in ...". It should be "for {k in TAU} {..." as in your original model. Or since TAU only appears once, you could drop it from your model and write "for {k in 0..tau} {...".

However I think also you don't want 1+tau*theta..lamda+tau*theta but rather 1+k*theta..lamda+k*theta so that as k increases the window is shifted. Also to get 1..4, 3..6, 5..8, and 7..10 you will need tau to equal 3 rather than 2.
Reply all
Reply to author
Forward
0 new messages