// sequence is a list of <job,mac,starttime> public int[,] Optimize(string name, out int optMakespan, out bool success, out int simplexIterations, int tmlim_min, List<Schedule.Dispatch> constraints = null) { GurobiJspModel model = new GurobiJspModel(this, name, tmlim_min); var xTimeJob = constraints != null ? model.Lookahead(constraints, out optMakespan) : model.Optimise(out optMakespan); simplexIterations = model.SimplexIterations; success = model.Status == GRB.Status.OPTIMAL; model.Dispose(); return xTimeJob; }
internal string CollectAndLabel(int pid) { string name = GetName(pid); DataRow instance = Data.Rows.Find(name); ProblemInstance prob = (ProblemInstance) instance["Problem"]; GurobiJspModel gurobiModel = new GurobiJspModel(prob, name, TMLIM_STEP); Schedule jssp = new Schedule(prob); int currentNumFeatures = 0; for (int step = 0; step < prob.Dimension; step++) { Preferences[pid - 1, step] = FindFeaturesForAllJobs(jssp, gurobiModel); int dispatchedJob = _trajectory(jssp, Preferences[pid - 1, step]); jssp.Dispatch1(dispatchedJob); gurobiModel.CommitConstraint(jssp.Sequence[step], step); Preferences[pid - 1, step].Find(x => x.Dispatch.Job == dispatchedJob).Followed = true; currentNumFeatures += Preferences[pid - 1, step].Count; } NumFeatures += currentNumFeatures; gurobiModel.Dispose(); RankPreferences(pid); return String.Format("{0}:{1} #{2} phi", FileInfo.Name, pid, currentNumFeatures); }