argmin/argmax of variables

520 views
Skip to first unread message

alexander....@outlook.com

unread,
Jul 18, 2015, 6:39:23 PM7/18/15
to am...@googlegroups.com
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

victor.z...@gmail.com

unread,
Jul 20, 2015, 1:31:56 PM7/20/15
to am...@googlegroups.com
I think you can compute the latest point in time where each job ran as

  max{t in T} t * x[j, t]

HTH,
Victor

--
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 ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

Alexander Rettkowski

unread,
Jul 20, 2015, 3:15:09 PM7/20/15
to am...@googlegroups.com
That's exactly what I was looking for. Thank you! :)
Reply all
Reply to author
Forward
0 new messages