out of range parameter

Hello everyone !

I want to substract two consecutive values of a parameter and I am worried about the sets…
Here is my problem :

P(t) is defined over t from 1 to 10

Then I define R(t)=P(t)-P(t-1)

What is the value of R(‘1’) ? Can I be sure that it is P(‘1’) ?
ideally I would like to have R(‘1’)=0…

Thx for your help !


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Hello Jacques,

I think you should try the following:

*Here you ensure that R(‘1’)=0
EQ1(t)$(ORD(t)=1)… R(t)=e=0;

*Here you compute R(t) for t>1
EQ2(t)$(ORD(t) gt 1)… R(t)=P(t)-P(t-1);

Hope that helps,

Konstantinos Petridis

Τη Πέμπτη, 12 Δεκεμβρίου 2013 12:40:10 μ.μ. UTC+2, ο χρήστης Jacques έγραψε:

Hello everyone !

I want to substract two consecutive values of a parameter and I am worried about the sets…
Here is my problem :

P(t) is defined over t from 1 to 10

Then I define R(t)=P(t)-P(t-1)

What is the value of R(‘1’) ? Can I be sure that it is P(‘1’) ?
ideally I would like to have R(‘1’)=0…

Thx for your help !


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Thank you Constantinos,
This works, but I would like to be sure that it is necessary, in order to optimize the code.
What would be the value of R(t)=P(t)-P(t-1) for t=1, if I do not define P(‘1’) specifically ?
P(t-1) is “out of range”, so how does GAMS handle it ?

Thx,
Jacques

Le jeudi 12 décembre 2013 11:49:06 UTC+1, Κωνσταντίνος Πετρίδης a écrit :

Hello Jacques,

I think you should try the following:

*Here you ensure that R(‘1’)=0
EQ1(t)$(ORD(t)=1)… R(t)=e=0;

*Here you compute R(t) for t>1
EQ2(t)$(ORD(t) gt 1)… R(t)=P(t)-P(t-1);

Hope that helps,

Konstantinos Petridis

Τη Πέμπτη, 12 Δεκεμβρίου 2013 12:40:10 μ.μ. UTC+2, ο χρήστης Jacques έγραψε:

Hello everyone !

I want to substract two consecutive values of a parameter and I am worried about the sets…
Here is my problem :

P(t) is defined over t from 1 to 10

Then I define R(t)=P(t)-P(t-1)

What is the value of R(‘1’) ? Can I be sure that it is P(‘1’) ?
ideally I would like to have R(‘1’)=0…

Thx for your help !


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Hi,

At t=1, the value of R(t) will be equal to P(t). The value of P(‘0’) by default is zero.



Yonas



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Jacques
Sent: 12. desember 2013 12:02
To: gamsworld@googlegroups.com
Subject: Re: out of range parameter



Thank you Constantinos,
This works, but I would like to be sure that it is necessary, in order to optimize the code.
What would be the value of R(t)=P(t)-P(t-1) for t=1, if I do not define P(‘1’) specifically ?
P(t-1) is “out of range”, so how does GAMS handle it ?

Thx,
Jacques

Le jeudi 12 décembre 2013 11:49:06 UTC+1, Κωνσταντίνος Πετρίδης a écrit :

Hello Jacques,

I think you should try the following:

*Here you ensure that R(‘1’)=0
EQ1(t)$(ORD(t)=1)… R(t)=e=0;

*Here you compute R(t) for t>1
EQ2(t)$(ORD(t) gt 1)… R(t)=P(t)-P(t-1);

Hope that helps,

Konstantinos Petridis

Τη Πέμπτη, 12 Δεκεμβρίου 2013 12:40:10 μ.μ. UTC+2, ο χρήστης Jacques έγραψε:

Hello everyone !

I want to substract two consecutive values of a parameter and I am worried about the sets…
Here is my problem :

P(t) is defined over t from 1 to 10

Then I define R(t)=P(t)-P(t-1)

What is the value of R(‘1’) ? Can I be sure that it is P(‘1’) ?
ideally I would like to have R(‘1’)=0…

Thx for your help !


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Dear Jacques,

I did the following in order to understand how GAMS handles this structure that you ask.

set t /1*10/;

parameter P(t), R(t),d;
P(t)=uniform(0,1);

R(t)=P(t)-P(t-1);
d=R(‘1’);
display d, R, P;

From the results you can see that R(1)=P(1) because there is no 0 label (e.g. P(0)).

Hope that helped,


Konstantinos Petridis


Τη Πέμπτη, 12 Δεκεμβρίου 2013 1:02:05 μ.μ. UTC+2, ο χρήστης Jacques έγραψε:

Thank you Constantinos,
This works, but I would like to be sure that it is necessary, in order to optimize the code.
What would be the value of R(t)=P(t)-P(t-1) for t=1, if I do not define P(‘1’) specifically ?
P(t-1) is “out of range”, so how does GAMS handle it ?

Thx,
Jacques

Le jeudi 12 décembre 2013 11:49:06 UTC+1, Κωνσταντίνος Πετρίδης a écrit :

Hello Jacques,

I think you should try the following:

*Here you ensure that R(‘1’)=0
EQ1(t)$(ORD(t)=1)… R(t)=e=0;

*Here you compute R(t) for t>1
EQ2(t)$(ORD(t) gt 1)… R(t)=P(t)-P(t-1);

Hope that helps,

Konstantinos Petridis

Τη Πέμπτη, 12 Δεκεμβρίου 2013 12:40:10 μ.μ. UTC+2, ο χρήστης Jacques έγραψε:

Hello everyone !

I want to substract two consecutive values of a parameter and I am worried about the sets…
Here is my problem :

P(t) is defined over t from 1 to 10

Then I define R(t)=P(t)-P(t-1)

What is the value of R(‘1’) ? Can I be sure that it is P(‘1’) ?
ideally I would like to have R(‘1’)=0…

Thx for your help !


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

For example, is it possible to fix “R.l(‘1’)=0;” in the parameter section, and avoid your first equation ?

Le jeudi 12 décembre 2013 12:02:05 UTC+1, Jacques a écrit :

Thank you Constantinos,
This works, but I would like to be sure that it is necessary, in order to optimize the code.
What would be the value of R(t)=P(t)-P(t-1) for t=1, if I do not define P(‘1’) specifically ?
P(t-1) is “out of range”, so how does GAMS handle it ?

Thx,
Jacques

Le jeudi 12 décembre 2013 11:49:06 UTC+1, Κωνσταντίνος Πετρίδης a écrit :

Hello Jacques,

I think you should try the following:

*Here you ensure that R(‘1’)=0
EQ1(t)$(ORD(t)=1)… R(t)=e=0;

*Here you compute R(t) for t>1
EQ2(t)$(ORD(t) gt 1)… R(t)=P(t)-P(t-1);

Hope that helps,

Konstantinos Petridis

Τη Πέμπτη, 12 Δεκεμβρίου 2013 12:40:10 μ.μ. UTC+2, ο χρήστης Jacques έγραψε:

Hello everyone !

I want to substract two consecutive values of a parameter and I am worried about the sets…
Here is my problem :

P(t) is defined over t from 1 to 10

Then I define R(t)=P(t)-P(t-1)

What is the value of R(‘1’) ? Can I be sure that it is P(‘1’) ?
ideally I would like to have R(‘1’)=0…

Thx for your help !


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Jacques, you have already been answered, but two things:

  1. To fix a variable, you would use R.fx(‘1’)=0 not .l, that sets the
    value for the solver’s first iteration.
  2. Fixing variables should be done at least after the variable has
    been declared, so be wary if you’re putting it in a parameter section.

Regards and good luck !!
Claudio

On Thu, Dec 12, 2013 at 8:20 AM, Jacques wrote:

For example, is it possible to fix “R.l(‘1’)=0;” in the parameter section,
and avoid your first equation ?

Le jeudi 12 décembre 2013 12:02:05 UTC+1, Jacques a écrit :

Thank you Constantinos,
This works, but I would like to be sure that it is necessary, in order to
optimize the code.
What would be the value of R(t)=P(t)-P(t-1) for t=1, if I do not define
P(‘1’) specifically ?
P(t-1) is “out of range”, so how does GAMS handle it ?

Thx,
Jacques

Le jeudi 12 décembre 2013 11:49:06 UTC+1, Κωνσταντίνος Πετρίδης a écrit :

Hello Jacques,

I think you should try the following:

*Here you ensure that R(‘1’)=0
EQ1(t)$(ORD(t)=1)… R(t)=e=0;

*Here you compute R(t) for t>1
EQ2(t)$(ORD(t) gt 1)… R(t)=P(t)-P(t-1);

Hope that helps,

Konstantinos Petridis

Τη Πέμπτη, 12 Δεκεμβρίου 2013 12:40:10 μ.μ. UTC+2, ο χρήστης Jacques
έγραψε:

Hello everyone !

I want to substract two consecutive values of a parameter and I am
worried about the sets…
Here is my problem :

P(t) is defined over t from 1 to 10

Then I define R(t)=P(t)-P(t-1)

What is the value of R(‘1’) ? Can I be sure that it is P(‘1’) ?
ideally I would like to have R(‘1’)=0…

Thx for your help !


“gamsworld” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\