Reputation: 1
I use AMPL for my thesis anybody can help me? it is always come out with "error syntax" in constraint area. Anybody can help this? I hope anybody can help my model, cause its for my thesis.
#VARIABLE
var Allocated {I,D,T} integer; # allocated to group i in district d in time period t (y_idt)
var Stored {D,T}integer; # stored in district d warehouse in time period t (w_dt)
var Shipped {K,D,T} integer; # shipped from distribution center k to district d warehouse in time-period t (x_kdt)
var Distribution_Center_set_up {K} binary; # 0/1 if distribution center k is set up / don't set up (omega_k)
var miu integer; # new free variable
#OBJECTIVE FUNCTION
maximize Z: miu
#CONSTRAINT
subj to Newcon {i in I, d in D, t in T}:
miu <= Allocated [i,d,t] / total_demand [i,d];
subj to con_2 {i in I, d in D}:
sum {t in T} Allocated[i,d,t] >= coverage_rate[i] * total_demand[i,d];
subj to con_3 {d in D, t in {1}}:
sum {DistributionCenter} Shipped[k,d,t] - sum {GroupType} Allocated;
subj to con_4 {d in D, t in T diff {1}}:
sum {DistributionCenter} Shipped[k,d,t] - sum {GroupType} Allocated;
subj to con_5 {k in K, t in T}:
sum {DemandPoint} Shipped[k,d,t] <= the_max_capacity[k,t];
subj to con_6 {k in K, d in D, t in T}:
Shipped[k,d,t] * Distribution_Center_set_up [k];
subj to con_7:
sum {DistributionCenter} cost_of_setting_up[k] * Distribution_Center_set_up[k]
+ sum {DistributionCenter,DemandPoint,TimePoint} per_dose_purchasing_cost * Shipped[k,d,t]
+ sum {DistributionCenter,DemandPoint,TimePoint} per_dose_transportation_cost[k,d] * Shipped[k,d,t]
+ sum {DemandPoint,TimePeriode} per_dose_holding_cost[d] * Stored[d,t] <= budget;
Upvotes: 0
Views: 78
Reputation: 378
subj to
is not a valid keyword for declaring constraints in AMPL. Use either subject to
or the shorter version s.t.
However, if that is your whole program, it is missing the set declarations (I
, D
, T
and K
).
If you are new to AMPL, you may want to read some AMPL introduction, such as this. There is a section on constraint declaration here.
Upvotes: 0