# [AMPL 25000] Location Problem

I am new to ampl. I need your help to review this constraint. I am going to explain a part of the problem :

``````n i : set of demand site
n j : set of candidate site
n k : set of type station (large, medium, small)
``````

var

``````var X {i in DemandSites, j in Sites} binary; #location that would be build
var Xjk {j in Sites, k in Types} binary; #type of the station would be build
``````

I would like to optimize location model to minimize cost.

``````minimize Total_Cost:
sum {i in DemandSites, j in Sites, k in Types} F[k} * Xjk[j,k];

subject to Constraint_coverage {i in DemandSites} :
sum {j in Sites} d[i,j] * X [i,j] >= demand[i];
``````

Can you help me review that constraint.
Thanks…

Your constraint named `Constraint_coverage` looks good. Of course, your model needs to also include AMPL statements to define the sets and parameters that are used in the constraint; for example:

``````set Sites;
set DemandSites;
param d {DemandSites,Sites};
param demand {DemandSites};
``````

I do have some concerns with your objective function `Total_Cost`:

``````minimize Total_Cost:
sum {i in DemandSites, j in Sites, k in Types} F[k} * Xjk[j,k];
``````

Of course, `F[k}` should be `F[k]`. More seriously, you are summing over `i` `in` `DemandSites`, but there is no `i` in `F[k]` `*` `Xjk[j,k]`. This could mean that something is missing from the objective expression.

Your question has been moved to our new user forum at discuss.ampl.com, and a response has been posted. To see the response, use this link:

To reply, click the red “Reply” button that follows the response. (Do not send an email reply to this message.)