public void Run(out double objValue, out string solutionString) { List <Day> days = new List <Day>(); days.Add(new Day(1, 900)); days.Add(new Day(2, 1440)); days.Add(new Day(3, 1260)); days.Add(new Day(4, 1620)); days.Add(new Day(5, 1296)); List <Method> methods = new List <Method>(); methods.Add(new Method("method1", 0.5, 0.4, 1)); methods.Add(new Method("method2", 0.25, 0.2, 2)); methods.Add(new Method("method3", 0.1, 0.1, 3)); LinnenRentalCo linnenRentalCo = new LinnenRentalCo(days, methods, 2.5); linnenRentalCo.Initialize(); linnenRentalCo.Build(); linnenRentalCo.Solve(); linnenRentalCo.SaveXml("linnenrentalco.xml"); LinnenRentalCo linnenRentalCo2 = LinnenRentalCo.LoadXml("linnenrentalco.xml"); linnenRentalCo2.Initialize(); linnenRentalCo2.Build(); linnenRentalCo2.Solve(out objValue, out solutionString); }
public static LinnenRentalCo LoadXml(string filePath) { using (XmlTextReader reader = new XmlTextReader(filePath)) { DataContractSerializer ser = new DataContractSerializer(typeof(LinnenRentalCo)); LinnenRentalCo deserialized = (LinnenRentalCo)ser.ReadObject(reader, true); reader.Close(); return(deserialized); } }