I'm completely new to AMPL and trying to solve a scheduling problem. Therefore, I decided to use binary decision variables x[j,t] which indicate, if job j runs at time t and added a sum constraint that only one job can run at a time (it's a single machine problem).
My problem now is to formulate the objective function: I need to get the difference from the latest point of time, where each job ran, to its release time. So I'm looking for something like argmax x[j,t] * t with j fixed for the latest point of time for each job j. The AMPL FAQs show an example of argmin as I did expect it, but that doesn't work for my var's as it seems that AMPL runs the for-loop directly after reading the model and not at each evaluation of the objective (Error at _cmdno 1 executing "for" command, no data for set Job... while reading the model).
That was what I tried:
for {j in Job} {
let argmax_xt := {t in Time: x[j, t]*t = max {tt in Time} x[j, tt]*tt};
let jobEnd[j] := first(argmin_xt);
}
minimize obj: sum {j in Job} (first(argmax_xt)-ReleaseTimes[j])
How can I find the argmin/argmax of var's?
Thanks in advance!
Alex