I have a problem consisting of a series of paths and a series of

nodes. I have a table that has, among other things, information on

what the start and end nodes are for each path.

In one of the equations, I have to reference a propery of the node (V

(i)), but I don’t know the index i explicitly. Instead, i is the

start node, which I have to look up for that path n. In other words,

I need to specify V(Param(n,“Start”)). GAMS doesn’t like this for

some reason. I set up a simple example problem below. I keep getting

an error where I have inserted [****] in the code. I’m sure I’d get

similar errors for later uses of similar code, but that’s the first

one it chokes on.

Sets

i nodes / 1*3 /
n paths / 1*3 /

p params / R, X, B, Start, End /

q calc param type / B, G, Y /;

Table Param(n,p) Path cost speed and node start-end parameters

R X B Start End

1 0.005 0.005 1.2 1 2

2 0.005 0.005 1.2 1 3

3 0.005 0.005 1.2 2 3;

Table CalcParams(n,q) reformulated path parameters

G B Y

1 132 20 -30

2 132 20 -30

3 132 20 -30;

Variables Value,

V(i),

VTheta(i),

PX(n,p);

Equations Obj,

PCalcStart(n,p);

Obj… Value =E= sum(n,sum(p$(sameas(p,“Start”)),PX(n,p)));

*PCalcStart(n,p)$(sameas(p,“Start”))… P(n,p) =E= -CalcParams(n,“G”)*

(V(Param****)*V(Param(n,“End”))*cos(ThetaV(Param

(n,“Start”))-ThetaV(Param(n,“End”)))) + CalcParams(n,“B”)*V(Param

(n,“Start”))*V(Param(n,“End”))*sin(ThetaV(Param(n,“Start”))-ThetaV

(Param(n,“End”)));

PCalcStart(n,p)$(sameas(p,“Start”))… PX(n,p) =E= CalcParams(n,“G”)*

(10-(V(Param(n,“Start”)))**2);

Model TestProb / All /;

Solve TestProb using NLP maximizing Value

execute_unload ‘TestOutput’;

The errors are as follows:

$121,148,8,409

8 ‘)’ expected

121 Set expected

148 Dimension different - The symbol is referenced with more/less

indices as declared

409 Unrecognizable item - skip to find a new statement

looking for a ‘;’ or a key word to get started again

I’m sure GAMS has a problem with my using Param(n,“Start”) as an index

in V(Param(n,“Start”)), but I need to get that index from the Param

table for the nth path in the “Start” column. That’s the only way to

know what that start node index is. Why is that a problem for GAMS?

Any insights on what the issue is or how I might solve it?

## Thanks much!

\

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.

\