Mads Olin
Mads Olin

Reputation: 1

How can i change my AMPL mod/data file for Capacity to not get syntax error

My problem from NEOS server comes out as:

amplin, line 16 (offset 239): syntax error context: param Capacity{i in >>> 1...m <<< }; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Data is:

param m := 4;
param n := 30;

param Facilitycost:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 :=
1   2   7   7   6
2   8   3   1   5
3   2   5   6   6
4   7   5   2   3
5   5   3   6   8
6   9   8   5   1
7   4   4   6   7
8   8   4   8   11
9   10  5   2   5
10  1   8   9   9
11  7   1   5   8
12  1   7   8   8
13  1   7   8   8
14  7   1   3   6
15  3   5   8   8
16  8   1   4   8
17  7   1   3   6
18  7   3   2   4
19  10  3   3   7
20  4   4   7   9
21  4   5   5   4
22  6   6   4   2
23  9   6   2   3
24  6   4   8   10
25  6   6   4   2
26  4   7   6   4
27  8   1   3   7
28  1   8   9   8
29  6   2   6   9
30  9   6   2   3;



param Capacity:= 1 5000 2 5000 3 5000 4 5000;


param Demand:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 :=
1   220
2   374
3   351
4   432
5   161
6   300
7   300
8   219
9   339
10  312
11  653
12  440
13  207
14  492
15  91
16  190
17  351
18  323
19  23
20  157
21  281
22  233
23  409
24  215
25  7
26  680
27  215
28  395
29  165
30  333;

My model is:

param m; #number of facilites
param n; #number of customers needed to be served

param Facilitycost{j in 1..n, i in 1..m};

param Capacity{i in 1...m};

param Demand{j in 1..n};

#THE DECISION VARIABLES

var AllocatedFacility{j in 1..n, i in 1..m} binary;

#OBJECTIVE FUNCTION
minimize Total_AllocationCost: sum {j in 1..n, i in 1..m}:
Facilitycost[j,i] * AllocatedFacility[j,i];

#THE CONSTRAINTS
s.t. CapacityConstraints {i in 1..m}:
Demand[j] * AllocatedFacility[j,i] <= Capacity[i];

s.t. AllocatedFacilityContraints {j in 1..n}:
sum {i in 1..m} AllocatedFacility[j,i] = 1;

How can i change Capacity as such that the condition is met as wanted for the colum i? Is the problem in the data of in the model?

Upvotes: 0

Views: 68

Answers (1)

G_B
G_B

Reputation: 1573

The syntax error for this line is because you have 1...m where you should have 1..m.

Upvotes: 0

Related Questions