[AMPL 25006] Station Type

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];

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

I am not sure how to understand your statement, “the result of Xjk or the selected station type is type number 1.” Do you mean that in the solution, all of the variables Xjk[j,k]=1 have k equal to 1? If so, I think the problem is that

  • Constraint3 and One_Type_Per_Location do not prevent Xjk[j,k]=1 only when k is equal to 1, and

  • the objective function can be minimized by a feasible solution that has Xjk[j,k]=1 only when k is equal to 1.

Maybe your model needs another constraint. Do you need to say, for example, that there can be only one location per type?

Also, be sure that your model is solving without any error messages. In that model statement that appears in your question, there is an obvious error where F[k} should be F[k].

I want the type of station selected to be different in each candidate location based on the capacity that can meet demand. What constraints should I add?