Problem with subtraction of two parameters

Hi
I have a problem in a large and complex model that regards subtraction
of two parameters. I have illustrated the problem in a very simple
program described below, so I can show my problem more clearly. The
complete program is:

set t/1*3/;
parameter a(t)/1=0,2=0,3=1/;
parameter b(t)/1=1,2=0,3=0/;
parameter c(t);
c(t)(ord(t) eq 1)=b(t)(ord(t) eq 1)-a(t)$(ord(t) eq 3);
display a,b,c;

I wish c(“1”)=b(“1”)-a(“3”), or 0=1-1. However, the above code gives
me an error in that c(“1”)=1. I understand there is a problem in my
use of the ord statement. However, I am just wondering how this should
be coded to ensure I get the correct result.
Thank you for any help.

\

Hi

I think, but I am not sure at all, because I don’t know how large your problem is, this may help :

First:

ALIAS (t,tt);

Second define a parameter like x(tt) ,equal to zero.

then for the specific element of set " tt " , like " t’ “, that you want a(” t’ ") takes value, do :


x("t’ ") =1;

then modify your equation to this:

c(t) (ord(t) eq 1) = b(t) (ord(t) eq 1) - ( SUM(tt, x(tt) * a(tt) );

as for all tt, xx(tt) is zero except for tt = 3, you will have desire equation :

c(“1”)=b(“1”)-a(“3”)

.
Good Luck


On Fri, Sep 16, 2011 at 5:15 AM, Graeme Doole wrote:

Hi
I have a problem in a large and complex model that regards subtraction
of two parameters. I have illustrated the problem in a very simple
program described below, so I can show my problem more clearly. The
complete program is:

set t/1*3/;
parameter a(t)/1=0,2=0,3=1/;
parameter b(t)/1=1,2=0,3=0/;
parameter c(t);
c(t)(ord(t) eq 1)=b(t)(ord(t) eq 1)-a(t)$(ord(t) eq 3);
display a,b,c;

I wish c(“1”)=b(“1”)-a(“3”), or 0=1-1. However, the above code gives
me an error in that c(“1”)=1. I understand there is a problem in my
use of the ord statement. However, I am just wondering how this should
be coded to ensure I get the correct result.
Thank you for any help.


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.



\

Babak Saleck Pay
M.Sc
Socio-Economic System Engineering
Group of Industrial Engineering
University of Tehran
Tehran,Iran


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.