Hi,
I’m trying to write an assignment whose value is dependent upon the
indices. The value isn’t a function of the indices, though. Rather,
it is a logical type of dependency. Basically, these paths in my
model have a start and an end. If the index for the assignment is
“Start”, then I want the assignment to use the opposite value, “End”.
I see in McCarl’s user guide that I can use if/then statements, but it
isn’t clear to me from the user guide if I can put them directly into
a direct assignment. What I need is a line of code that works as
follows:
TestValue(n,p) $(sameas(p,“Start”) or sameas(p,“End”)) = If(sameas
(p,“Start”),Param(n,“Start”); else Param(n,“End”));
I get all kinds of errors when I try to compile this though. I wanted
to see if anyone knew a way to get this to work. If I can’t do this
with the if/then statement, is there another way to do this?
Thanks for any help. My entire code is shown below.
Sets
n lines / 1*3 /
p params / R, X, B, Start, End, Imax /
Table Param(n,p) line param p for line n
R X B Start End Imax
1 0.01 0.03 0.8 1 2 7
2 0.01 0.03 0.8 1 3 7
3 0.01 0.03 0.8 2 3
7 ;
Parameter TestValue(n,p);
TestValue(n,p) $(sameas(p,“Start”) or sameas(p,“End”)) = If(sameas
(p,“Start”),Param(n,“Start”); else Param(n,“End”));
execute_unload ‘TestOutput’;
–
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.
\