error 148 please help me

Dear Members:
I’m a newbie in gams, there is a problem i can’t solve, i 'm very appreciate for your help!
Here is my code :


set g /g1g10/
s /s0
s2/
h /h1*h24/ ;

parameters

l(h)
/h1 1022, h2 963, h3 978, h4 993 , h5 1037 , h6 1066
h7 1095, h8 1124, h9 1138, h10 1154, h11 1182, h12 1197
h13 1242, h14 1271, h15 1314, h16 1372, h17 1314, h18 1271
h19 1285, h20 1290, h21 1372, h22 1459, h23 1459, h24 1081 / ;

table a
s2 s1 s0 pmin pmax
g1 0.000786 0.2700 8.00 30 100
g2 0.000792 0.3000 5.00 20 80
g3 0.000764 0.2800 6.40 25 120
g4 0.000270 0.2657 20.0 50 250
g5 0.000424 0.3080 5.80 50 250
g6 0.001020 0.2800 3.00 15 60
g7 0.000578 0.2529 9.80 120 320
g8 0.000296 0.2427 16.4 75 300
g9 0.000254 0.2791 21.0 250 520
g10 0.000522 0.2700 14.4 75 280

parameters maxg(g,h)
ming(g,h) ;


loop(h,maxg(g,h) = a(g,“pmax”)) ;
loop(h,ming(g,h) = a(g,“pmin”)) ;



display maxg,ming;

variable p(g,h)
z(h) ;
positive variable p ;

equations cost(h)
totalload(h)
constraint1(g,h)
constraint2(g,h) ;

cost(h)… z(h) =e= sum(g,sum(s,a(g,s)*p(g,h)**(ord(s)-1)));
totalload(h)… sum(g,p(g,h)) =e= l(h);
constraint1(g,h)… p(g,h) =l= maxg(g,h);
constraint2(g,h)… p(g,h) =g= ming(g,h);


model burnup /all/;

option nlp=conopt;

solve burnup using nlp minimizing z(h);

display z(h).l;


Here is error :
solve burnup using nlp minimizing z(h);
**** $148,257,409
57
58 display z(h).l;
**** $143,141,409
error 148 dimension different - the symbol is referenced with more/less indices as declared

How can i get 24 different z?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Steven try this

set g /g1g10/
s /s0
s2/
h /h1*h24/
header/objval, modelstat/;
parameters

l(h)
/h1 1022, h2 963, h3 978, h4 993 , h5 1037 , h6 1066
h7 1095, h8 1124, h9 1138, h10 1154, h11 1182, h12 1197
h13 1242, h14 1271, h15 1314, h16 1372, h17 1314, h18 1271
h19 1285, h20 1290, h21 1372, h22 1459, h23 1459, h24 1081 / ;

table a
s2 s1 s0 pmin pmax
g1 0.000786 0.2700 8.00 30 100
g2 0.000792 0.3000 5.00 20 80
g3 0.000764 0.2800 6.40 25 120
g4 0.000270 0.2657 20.0 50 250
g5 0.000424 0.3080 5.80 50 250
g6 0.001020 0.2800 3.00 15 60
g7 0.000578 0.2529 9.80 120 320
g8 0.000296 0.2427 16.4 75 300
g9 0.000254 0.2791 21.0 250 520
g10 0.000522 0.2700 14.4 75 280

parameters maxg(g,h)
ming(g,h) ;


loop(h,maxg(g,h) = a(g,“pmax”)) ;
loop(h,ming(g,h) = a(g,“pmin”)) ;

parameters ll(h)
results(h,header);

display maxg,ming;

variable p(g,h)
z ;
positive variable p ;

equations cost
totalload(h)
constraint1(g,h)
constraint2(g,h) ;

cost… z =e= sum(g,sum(h,sum(s,a(g,s)*p(g,h)**(ord(s)-1))));
totalload(h)… sum(g,p(g,h)) =e= ll(h);
constraint1(g,h)… p(g,h) =l= maxg(g,h);
constraint2(g,h)… p(g,h) =g= ming(g,h);

alias(h,hh);


model burnup /all/;

loop(hh,
ll(hh)=l(hh);
solve burnup using nlp minimizing z;
results(hh,‘objval’)=z.l;
results(hh,‘modelstat’)=burnup.modelstat;
);
display results;

I hope I helped…


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

HI please check the answer i am not sure what i did right or not, Please reply are you getting right answer or not it will help me to learn more.
Any way i tried to add all z(h) to new variable objvar and minimize the summation of z(h) in the equation called OBJECT

OBJECT…objvar=E=SUM(h,z(h));

I also introduces p(g,h),z(h) as positive variable becuase by defining them as positive variable, there lower limit will be automatically 0
where as for free variable lower limit will be -inf. Plz check if the lower limit of all is 0 then keep it otherwise define it if it is negative.


set g /g1g10/
s /s0
s2/
h /h1*h24/ ;

parameters

l(h)
/h1 1022, h2 963, h3 978, h4 993 , h5 1037 , h6 1066
h7 1095, h8 1124, h9 1138, h10 1154, h11 1182, h12 1197
h13 1242, h14 1271, h15 1314, h16 1372, h17 1314, h18 1271
h19 1285, h20 1290, h21 1372, h22 1459, h23 1459, h24 1081 / ;

table a
s2 s1 s0 pmin pmax
g1 0.000786 0.2700 8.00 30 100
g2 0.000792 0.3000 5.00 20 80
g3 0.000764 0.2800 6.40 25 120
g4 0.000270 0.2657 20.0 50 250
g5 0.000424 0.3080 5.80 50 250
g6 0.001020 0.2800 3.00 15 60
g7 0.000578 0.2529 9.80 120 320
g8 0.000296 0.2427 16.4 75 300
g9 0.000254 0.2791 21.0 250 520
g10 0.000522 0.2700 14.4 75 280

parameters maxg(g,h)
ming(g,h) ;


loop(h,maxg(g,h) = a(g,“pmax”) );

loop(h,ming(g,h) = a(g,“pmin”)) ;



display maxg,ming;

variable
objvar;

positive variable p(g,h),z(h) ;

equations cost
totalload(h)
constraint1(g,h)
constraint2(g,h),
OBJECT ;

cost(h)… z(h) =e= sum(g,sum(s,a(g,s)*p(g,h)**(ord(s)-1)));
totalload(h)… sum(g,p(g,h)) =e= l(h);
constraint1(g,h)… p(g,h) =l= maxg(g,h);
constraint2(g,h)… p(g,h) =g= ming(g,h);
OBJECT…objvar=E=SUM(h,z(h));



model burnup /all/;

option nlp=conopt;

solve burnup using nlp minimizing objvar;
DISPLAY objvar.L,z.L;







On Sun, Sep 22, 2013 at 4:35 PM, wrote:

Dear Members:
I’m a newbie in gams, there is a problem i can’t solve, i 'm very appreciate for your help!
Here is my code :


set g /g1g10/
s /s0
s2/
h /h1*h24/ ;

parameters

l(h)
/h1 1022, h2 963, h3 978, h4 993 , h5 1037 , h6 1066
h7 1095, h8 1124, h9 1138, h10 1154, h11 1182, h12 1197
h13 1242, h14 1271, h15 1314, h16 1372, h17 1314, h18 1271
h19 1285, h20 1290, h21 1372, h22 1459, h23 1459, h24 1081 / ;

table a
s2 s1 s0 pmin pmax
g1 0.000786 0.2700 8.00 30 100
g2 0.000792 0.3000 5.00 20 80
g3 0.000764 0.2800 6.40 25 120
g4 0.000270 0.2657 20.0 50 250
g5 0.000424 0.3080 5.80 50 250
g6 0.001020 0.2800 3.00 15 60
g7 0.000578 0.2529 9.80 120 320
g8 0.000296 0.2427 16.4 75 300
g9 0.000254 0.2791 21.0 250 520
g10 0.000522 0.2700 14.4 75 280

parameters maxg(g,h)
ming(g,h) ;


loop(h,maxg(g,h) = a(g,“pmax”)) ;
loop(h,ming(g,h) = a(g,“pmin”)) ;



display maxg,ming;

variable p(g,h)
z(h) ;
positive variable p ;

equations cost(h)
totalload(h)
constraint1(g,h)
constraint2(g,h) ;

cost(h)… z(h) =e= sum(g,sum(s,a(g,s)*p(g,h)**(ord(s)-1)));
totalload(h)… sum(g,p(g,h)) =e= l(h);
constraint1(g,h)… p(g,h) =l= maxg(g,h);
constraint2(g,h)… p(g,h) =g= ming(g,h);


model burnup /all/;

option nlp=conopt;

solve burnup using nlp minimizing z(h);

display z(h).l;


Here is error :
solve burnup using nlp minimizing z(h);
**** $148,257,409
57
58 display z(h).l;
**** $143,141,409
error 148 dimension different - the symbol is referenced with more/less indices as declared

How can i get 24 different z?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.



\

Regards,
Owais Nooruddin

+358465700556


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

I really appreciate your help! Your answer make me learn a new gams trick!


\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Thank you, Owais! Your answer is right!
Your answer make me realize the importance of improving my mathematical thinking method. Thank you again for your help.
I have upload two methods in gams. Maybe these can help other members who meet my problem.


Owais Nooruddin.gms (1.61 KB)
error148.gms (1.73 KB)