Reputation: 31
I am trying to set a custom objective function with ortools for the job shop problem, and I am confused on how to implement it. I am trying to minimize tardiness across all jobs, however I am unsure how to create a tardiness coefficient to minimize.
My understanding is that the i need to create a intvar with a range to go into the objective monitor. Is this correct? and if so could anyone point me in the direction of how to create it? My current goal is to take an array of due dates, and subtract it from the end time of the last operation of each job, I just am not sure how to feed that into the solver.
Below is from the google tutorial:
obj_var = solver.Max([all_tasks[(i, len(machines[i])-1)].EndExpr()
for i in all_jobs])
objective_monitor = solver.Minimize(obj_var - obj_end, 1)
Upvotes: 3
Views: 1673
Reputation: 11014
Answering for the record.
https://github.com/google/or-tools/blob/stable/examples/cpp/weighted_tardiness_sat.cc
Upvotes: 1