public void TestBudgetRelaxations(string filename, double stepsize) { var data = Data.ReadXml(dataPath + filename, "120", "4"); var formulation = ProblemFormulation.UD2NoOverbook; var newrooms = CreateRoomsFixedSize(data, 25, 1); data.SetRoomList(newrooms); var model = new CCTModel(data, formulation, new CCTModel.MIPModelParameters() { UseRoomsAsTypes = true, UseStageIandII = false, TuneGurobi = true, SaveBoundInformation = true, }); model.RelaxModel(); model.SetObjective(0, 1, 0); model.Optimize(); var min = model.Objective; // Math.Floor(model.Objective*100)/100; Console.WriteLine($"Minimum budget for relaxed: {min}"); model = new CCTModel(data, formulation, new CCTModel.MIPModelParameters() { UseRoomsAsTypes = true, UseStageIandII = false, TuneGurobi = true, SaveBoundInformation = true, }); //model.WriteModel(@"c:\temp\model.lp"); var bounds = new List <Tuple <double, double, double, double> >(); double prevobj = double.PositiveInfinity; int lasts = 5; for (double budget = min; budget < min * 2; budget += stepsize) { model.RelaxModel(); Console.WriteLine($"Budget:{budget : 0.00} "); model.SetBudgetConstraint(budget); if (model.Optimize(300)) { bounds.Add(Tuple.Create(budget, model.Objective, formulation.MinimumWorkingDaysWeight * model.ObjMWD, formulation.CurriculumCompactnessWeight * model.ObjCC)); //Save each objective? MWD CC if (prevobj - model.Objective < 1e-6) { lasts--; } if (lasts == 0) { break; } prevobj = model.Objective; } } Console.WriteLine("Budget;Obj;MWD;CC"); Console.WriteLine(string.Join("\n", bounds.Select(b => $"{b.Item1 : #.###};{b.Item2: #.###};{b.Item3: #.###};{b.Item4: #.###}"))); }