Dear All,

I am pretty new to GAMS and I encountered the following problem. I

would like to model relation:

p(i) = x(1) + x(2) + … + x(i), for i = 1, …, 5

where p(i) and x(i) are integer and binary variable, respectively.

I tried using alias and $ without any success. I don’t want to bother

you with the whole formulation, so I am extracting here a few lines of

code that does not work:

set i /1*5/;

alias (i,j);

eq(i)… p(i) =e= sum(j$(j <= i), x(j));

I would very much appreciate your help. Please note that it reports

different dimensions (error 148) and incompatible operands (error

135)

Nikola

\

Hello Nikola,

you should use the ORD() command as follows;

eq(i)… p(i) =e= sum(j$(ord(j) Date: Sat, 5 Feb 2011 18:34:11 -0800

Subject: Summation Problem

From: nikola.didi@gmail.com

To: gamsworld@googlegroups.com

Dear All,

I am pretty new to GAMS and I encountered the following problem. I

would like to model relation:

p(i) = x(1) + x(2) + … + x(i), for i = 1, …, 5

where p(i) and x(i) are integer and binary variable, respectively.

I tried using alias and $ without any success. I don’t want to bother

you with the whole formulation, so I am extracting here a few lines of

code that does not work:

set i /1*5/;

alias (i,j);

eq(i)… p(i) =e= sum(j$(j

I would very much appreciate your help. Please note that it reports

different dimensions (error 148) and incompatible operands (error

135)

Nikola

–

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.

Hi Nikola

use ord:

set i /1*10/;

alias(i,j);

parameter x(i);

x(i) =uniform(0,1);

variable p(i);

equation eq(i);

eq(i)… p(i) =e= sum(j$(ord(j) wrote:

Dear All,

I am pretty new to GAMS and I encountered the following problem. I

would like to model relation:

p(i) = x(1) + x(2) + … + x(i), for i = 1, …, 5

where p(i) and x(i) are integer and binary variable, respectively.

I tried using alias and $ without any success. I don’t want to bother

you with the whole formulation, so I am extracting here a few lines of

code that does not work:

set i /1*5/;

alias (i,j);

eq(i)… p(i) =e= sum(j$(j <= i), x(j));

I would very much appreciate your help. Please note that it reports

different dimensions (error 148) and incompatible operands (error

135)

Nikola

Renger van Nieuwkoop

–

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.

I would like to let you know that Mohammad was very kind to provide

his help. Just in case somebody might be interested in this, I am

posting his hint:

eq(i)… p(i) =e= sum(j$(ORD(j) wrote:

Dear All,

I am pretty new to GAMS and I encountered the following problem. I

would like to model relation:

p(i) = x(1) + x(2) + … + x(i), for i = 1, …, 5

where p(i) and x(i) are integer and binary variable, respectively.

I tried using alias and $ without any success. I don’t want to bother

you with the whole formulation, so I am extracting here a few lines of

code that does not work:

set i /1*5/;

alias (i,j);

eq(i)… p(i) =e= sum(j$(j >

I would very much appreciate your help. Please note that it reports

different dimensions (error 148) and incompatible operands (error

135)

Nikola

\

Hello Nikola,

try this:

eq(i)… p(i) =e= sum(j$(ord(j) wrote:

Dear All,

I am pretty new to GAMS and I encountered the following problem. I

would like to model relation:

p(i) = x(1) + x(2) + … + x(i), for i = 1, …, 5

where p(i) and x(i) are integer and binary variable, respectively.

I tried using alias and $ without any success. I don’t want to bother

you with the whole formulation, so I am extracting here a few lines of

code that does not work:

set i /1*5/;

alias (i,j);

eq(i)… p(i) =e= sum(j$(j <= i), x(j));

I would very much appreciate your help. Please note that it reports

different dimensions (error 148) and incompatible operands (error

135)

Nikola

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.

Dear Nikola

In GAMS, set members are stored as strings and not numbers. Therefore

you cannot use relational operators on them directly. Instead, you

should work on their respective orders. Your code will be working if

corrected as follows:

eq(i)… p(i) =e= sum(j$((ord(j) wrote:

Dear All,

I am pretty new to GAMS and I encountered the following problem. I

would like to model relation:

p(i) = x(1) + x(2) + … + x(i), for i = 1, …, 5

where p(i) and x(i) are integer and binary variable, respectively.

I tried using alias and $ without any success. I don’t want to bother

you with the whole formulation, so I am extracting here a few lines of

code that does not work:

set i /1*5/;

alias (i,j);

eq(i)… p(i) =e= sum(j$(j >

I would very much appreciate your help. Please note that it reports

different dimensions (error 148) and incompatible operands (error

135)

Nikola

\