Station Type

Skip to first unread message

Eriska Prasetiowati

Mar 22, 2024, 6:24:35 PMMar 22
to AMPL Modeling Language
Hello, can you help me to fix my problem. I am going to explain a part of the problem:
var X {i in DemandSites, j in Sites} binary; #candidate_location
var Xjk {j in Sites, k in Types} binary; #station type
var F {k in Types} >= 0; #auxiliary variable of total cost

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];constraint
subject to Constraint_coverage {i in DemandSites} :
    sum {j in Sites} d[i,j] * X [i,j] >= demand[i]; #d[i,j]_distance

subject to Constraint3 {j in Sites, k in Types}:
    Xjk[j,k] * F[k] <= Cmax;

subject to One_Type_Per_Location {i in DemandSites, j in Sites}:
    sum{k in Types} Xjk[j,k] = 1;

subject to dem {i in DemandSites}:
    sum {j in Sites} X[i,j] = 1;
My problem is the result of Xjk or the selected station type is type number 1. Why this problem happens. I expected there are different types in different location. Please help me solve this problem.Thanks

AMPL Google Group

Mar 23, 2024, 4:45:55 PMMar 23
to AMPL Modeling Language
Your question has been moved to our new user forum at, 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.)

Robert Fourer

We're switching to a new, enhanced user forum.
Join it now at
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Reply all
Reply to author
0 new messages