I try to minimize the total net present value of the cost of a simple ware house problem.

But when I run the prblem with NLP, it shows an error “Dimension different - The symbol is referenced with more/less indices as declared”.

Why this error and how can I solve the problem?

Set

t time /1*4/;

scalar i /0.01/;

parameter

SP(t) selling price

/

1 10

2 12

3 8

4 9

/;

parameter

IS(t) initial stock /1 50/ ;

Scalar

SC storing cost /1/

SCap store capacity /100/;

variable

buy(t)

sell(t)

stock(t)

TC;

positive variable buy, sell, stock;

equation

cost

inventory(t);

cost… TC =e= sum[t, [{SP(t)*(buy(t)-sell(t))+SC*stock(t)}/((1+i)**t)]];

inventory(t)…stock(t) =e= stock(t-1)+buy(t)-sell(t)+IS(t);

stock.up(t) = Scap;

Model swp ‘simple warehouse problem’ / all /;

solve swp maximizing TC using nlp;