Assigning value to parameters

Hi All,
I’m using Gams for the very first time for modelling purpose and I’m stuck with a problem for the past 3-4 days. I’ve gone through the manual but couldn’t figure out the reason behind this error. I would highly appreciate if someone can help me out with this issue.

Gams Code:


Set i /14/ ;
Set j /1
4/ ;
Set k /0*1/ ;
Set s /0/;

Scalar h;
h = 5;

Parameter
alpha(i) / 1 0, 2 15, 3 12, 4 0/
beta(i) / 1 4, 2 5, 3 2, 4 2/ ;

Parameter c(i,j,k), d(i,s,k);

****Below mentioned is the part of code, that is generating errors:

c(i,j,k)= h*(j-i) + alpha(i)k ;
d(i,s,k)= beta(i)
(1-k) - alpha(i)*k ;


Error being thrown by the compiler is:
Error 148: Dimension different- The symbol is referenced with more/less indices as declared.


Logically, I find the definition of c(i,j,k) and d(i,s,k) to be fine and thus I’m unable to comprehend the reason for this error. Going further I defined a Parameter II(i) and assigned it value as follows,

II(i) = i;

Even this simple statement throws the same error.

Thanks & Regards,
Akshat


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/-zIOTTUSeLsJ.
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 All,
Surprisingly and luckily after posting the above issue on the group, I realized the mistake I was making and resolved it.

Regards,
Akshat

On Tuesday, July 3, 2012 1:43:24 PM UTC-4, Akshat Dimri wrote:

Hi All,
I’m using Gams for the very first time for modelling purpose and I’m stuck with a problem for the past 3-4 days. I’ve gone through the manual but couldn’t figure out the reason behind this error. I would highly appreciate if someone can help me out with this issue.

Gams Code:


Set i /14/ ;
Set j /1
4/ ;
Set k /0*1/ ;
Set s /0/;

Scalar h;
h = 5;

Parameter
alpha(i) / 1 0, 2 15, 3 12, 4 0/
beta(i) / 1 4, 2 5, 3 2, 4 2/ ;

Parameter c(i,j,k), d(i,s,k);

****Below mentioned is the part of code, that is generating errors:

c(i,j,k)= h*(j-i) + alpha(i)k ;
d(i,s,k)= beta(i)
(1-k) - alpha(i)*k ;


Error being thrown by the compiler is:
Error 148: Dimension different- The symbol is referenced with more/less indices as declared.


Logically, I find the definition of c(i,j,k) and d(i,s,k) to be fine and thus I’m unable to comprehend the reason for this error. Going further I defined a Parameter II(i) and assigned it value as follows,

II(i) = i;

Even this simple statement throws the same error.

Thanks & Regards,
Akshat


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/_FEEFza6Fx4J.
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
You can’t use a set element from i or j like this h*(i-j). Although you defined them as 1*4, these are not Interpreted as numbers. Take a look at the use of ord and card in the Manual.
Renger

Von meinem iPhone gesendet

Am 03.07.2012 um 20:33 schrieb “Akshat Dimri” :

Hi All,
I’m using Gams for the very first time for modelling purpose and I’m stuck with a problem for the past 3-4 days. I’ve gone through the manual but couldn’t figure out the reason behind this error. I would highly appreciate if someone can help me out with this issue.

Gams Code:


Set i /14/ ;
Set j /1
4/ ;
Set k /0*1/ ;
Set s /0/;

Scalar h;
h = 5;

Parameter
alpha(i) / 1 0, 2 15, 3 12, 4 0/
beta(i) / 1 4, 2 5, 3 2, 4 2/ ;

Parameter c(i,j,k), d(i,s,k);

****Below mentioned is the part of code, that is generating errors:

c(i,j,k)= h*(j-i) + alpha(i)k ;
d(i,s,k)= beta(i)
(1-k) - alpha(i)*k ;


Error being thrown by the compiler is:
Error 148: Dimension different- The symbol is referenced with more/less indices as declared.


Logically, I find the definition of c(i,j,k) and d(i,s,k) to be fine and thus I’m unable to comprehend the reason for this error. Going further I defined a Parameter II(i) and assigned it value as follows,

II(i) = i;

Even this simple statement throws the same error.

Thanks & Regards,
Akshat


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

Thanks Renger. I used the .val property to extract the integer values out of the set elements.

Regards,
Akshat

On Tuesday, July 3, 2012 2:43:24 PM UTC-4, Renger van Nieuwkoop wrote:

Hi
You can’t use a set element from i or j like this h*(i-j). Although you defined them as 1*4, these are not Interpreted as numbers. Take a look at the use of ord and card in the Manual.
Renger

Von meinem iPhone gesendet

Am 03.07.2012 um 20:33 schrieb “Akshat Dimri” :

Hi All,
I'm using Gams for the very first time for modelling purpose and I'm stuck with a problem for the past 3-4 days. I've gone through the manual but couldn't figure out the reason behind this error.  I would highly appreciate if someone can help me out with this issue.

Gams Code:

******************************
Set i /1*4/ ;
Set j /1*4/ ;
Set k /0*1/ ;
Set s /0/;

Scalar h;
  h = 5;

Parameter
  alpha(i) / 1 0, 2 15, 3 12, 4 0/
  beta(i) / 1 4, 2 5, 3 2, 4 2/      ;

Parameter c(i,j,k), d(i,s,k);

****Below mentioned is the part of code, that is generating errors:

 c(i,j,k)= h*(j-i) + alpha(i)*k ;
 d(i,s,k)= beta(i)*(1-k) - alpha(i)*k ;

*********************

Error being thrown by the compiler is:
Error 148:  Dimension different- The symbol is referenced with more/less indices as declared.
************************

Logically, I find the definition of c(i,j,k) and d(i,s,k) to be fine and thus I'm unable to comprehend the reason for this error.  Going further I defined a Parameter II(i) and assigned it value as follows,

II(i) = i;

Even this simple statement throws the same error.

Thanks & Regards,
Akshat

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