Error 495 and Error 141 : Load Dimensions are different and symbol declared but no values have been assigned Topic is solved

Problems with modeling
Post Reply
sachinpatel_03
User
User
Posts: 7
Joined: 5 years ago

Error 495 and Error 141 : Load Dimensions are different and symbol declared but no values have been assigned

Post by sachinpatel_03 »

Hello I'm having problem in running my code. I'm using data from the excel sheet and having errors. please help I've been stuck on this for two weeks now.


$call gdxxrw.exe i=Messer_data_MP.xlsx output=Calendar.gdx set=t rng=Calendar!A11:A754 rdim=1 set=scn rng=Calendar!B759:CV760 cdim=1 par=ECONCOST rng=Calendar!A761:CV1000 rdim=1 cdim=0 trace=3

set
scn /1*99/
t(*)
;

parameter
ECONCOST(t,scn)
;

variable
Profit(scn)
;

equations
OF
Profit_eq
;

Profit_eq.. loop(scn, Profit(scn)=E=ECONCOST(t,scn)) display Profit(scn)$(Profit(scn)=g=Profit(scn-1) or display Profit(scn-1)
OF.. OF=E=Profit(scn)*2
;

Now, i actually have two queries.
1. I'm getting errors 495(Load Dimensions are different) and 141 (symbol declared but no values have been assigned) and many other errors after that but these first two errors i think may have been causing others.
2. here ECONCOST parameter is a 2-D matrix of size (168 = t,99 = scn). I want to run the program in such a way that the profit is calculated for 99 times that is for each column but only the greatest value of the profit associated with the particular column is saved and displayed. Eg. like program can not jump from one scn column to another scn column for any value of row 't'

scn 1 2 3 4 .................
t 1 a e i m
2 b f j n
3 c g k o
4 d h l p
.
.
.

so i want to first calculate the profit for scn 1 ( i.e for a b c d as value of t) and then calculate it for scn 2 (i.e for e f g h as value of t) compare the profit for scn1 and scn 2. keep the greater value and again run it for scn 3 and repeat the process.

how do i do this?
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Error 495 and Error 141 : Load Dimensions are different and symbol declared but no values have been assigned

Post by Renger »

Hi
You have a two-dimensional variable with 1 dimension in the row and 1 dimension in the column, so you should inform gdxxrw accordingly with rdim=1 cdim=1 instead of 1 0.
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply