Reputation: 58
Here is my model.
set ch ;
set k ;
param a{i in ch , j in k};
param b{i in ch };
param c{j in k };
var x{i in ch , j in k}>= 0;
minimize cost: sum{i in ch , j in k} x[i,j]* a[i,j];
s.t. D{i in ch }: sum{j in k} x[i,j] >= b[i];
s.t. E{j in k }: sum{i in ch } x[i,j] <= c[j];
data;
set ch := ch1 ch2 ch3;
set k := k1 k2;
param a : ch1 ch2 ch3 :=
k1 100 180 100
k2 50 120 80;
param b := ch1 50
ch2 80
ch3 100;
param c := k1 400
k2 90;
solve;
display x{i in ch , j in k};
end;
I got the following error when solving the model:
cau5.mod:25: syntax error in data section
This is really confusing because there is a model that have the same format but solving just fine. Please someone help.
Upvotes: 2
Views: 78
Reputation: 55524
The problem is that you have row and column keys swapped in the data table for a
. You can add (tr)
which means "transpose" to fix this:
param a (tr) : ch1 ch2 ch3 :=
k1 100 180 100
k2 50 120 80;
Upvotes: 2