- Timestamp:
- 02/03/17 09:15:44 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Problems.FacilityLocation.CplexSolver/3.3/FLPCplexSolver.cs
r14595 r14642 84 84 var cplex = factory.CreateCplex(); 85 85 86 var errorHandler = factory.CreateOplErrorHandler();87 86 88 var dataSource = new FLPDataSource(factory, Problem);89 87 var model = Assembly.GetExecutingAssembly().GetManifestResourceNames().SingleOrDefault(x => x.EndsWith(@".FLP.mod")); 90 88 var modelStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(model); … … 95 93 using (var reader = new StreamReader(modelStream)) 96 94 using (var modelSource = factory.CreateOplModelSourceFromString(reader.ReadToEnd(), Path.GetFileNameWithoutExtension(model))) 95 using (var errorHandler = factory.CreateOplErrorHandler()) 97 96 using (var settings = factory.CreateOplSettings(errorHandler)) 98 97 using (var def = factory.CreateOplModelDefinition(modelSource, settings)) 99 using (var opl = factory.CreateOplModel(def, cplex)) { 98 using (var opl = factory.CreateOplModel(def, cplex)) 99 using (var dataSource = new FLPDataSource(factory, Problem)) { 100 100 opl.AddDataSource(dataSource); 101 101 opl.Generate(); 102 102 cplex.SetParam(Cplex.DoubleParam.TiLim, MaximumRuntimeParameter.Value.Value.TotalSeconds); 103 //cplex.ExportModel("model.lp");104 //opl.ConvertAllIntVars();105 103 var solved = cplex.Solve(); 106 104 var assignment = new IntegerVector(customers); … … 113 111 114 112 var sol = opl.GetElement(FLPDataSource.CustomerDepotAssignment).AsIntMap(); 115 113 116 114 for (var i = 0; i < depots; i++) { 117 115 var solI = sol.GetSub(i);
Note: See TracChangeset
for help on using the changeset viewer.