Dear ,

I hope this email finds you well. I am currently working on building an optimization model in AMPL and have encountered a persistent issue that has been perplexing me for quite some time. I am reaching out to seek your guidance and expertise in resolving this matter.

To provide some context, I am dealing with binary variables, Phi[k, c], where k belongs to the set {1, 2, 3, …, 9}. As an illustrative example, the values of Phi[k, c] might be {0, 0, 0, 1, 0, 0, 1, 0, 1}. My objective is to establish constraints that would allow me to select the minimum value of k when Phi[k, c] equals 1. In the provided example, I would like to determine the minimum k corresponding to the first occurrence of 1, which is k=3.

In attempting to express this in AMPL, I entered the following constraint:

subject to k_min_constraint{c in car_ID}:

k_min[c] = min{k in KK: Phi[k, c] = 1}*k;

However, I encountered an error message stating: “Variable in such-that part of set specification.”

I would greatly appreciate it if you could provide insights into how I can properly formulate this constraint or suggest an alternative approach to achieve the desired result. Your assistance in resolving this matter would be invaluable to me.

Thank you very much for your time and consideration. I look forward to hearing from you soon.

Best regards,

Liufan