error in notation for equation

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 / 13 /
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.


\

Hi,

I am getting the same problem in my code for exactly the same reason. I believe you have had sorted your problem out by now! Any advice for me?

Thanks
Meysam

On Thursday, 31 December 2009 20:33:54 UTC, emily wrote:

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 / 13 /
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 view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/x1HbFRStbwkJ.
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.

Hi Meysam



You have V(Param(n,“Start”))), but V is defined over i (it is impossible to use a parameter as a set in a variable!),



Cheers



Renger



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Meysam
Sent: Wednesday, August 15, 2012 1:07 AM
To: gamsworld@googlegroups.com
Subject: Re: error in notation for equation



Hi,



I am getting the same problem in my code for exactly the same reason. I believe you have had sorted your problem out by now! Any advice for me?



Thanks

Meysam

On Thursday, 31 December 2009 20:33:54 UTC, emily wrote:

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 / 13 /
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 view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/x1HbFRStbwkJ.
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.


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.