public Task <IHM1BOutputContext> Solve( IAbstractFactory abstractFactory, IHM1BConfiguration HM1BConfiguration, IHM1BInputContext HM1BInputContext, ISolverConfiguration solverConfiguration, HM1BEncodingEnum HM1BEncodingEnum) { return(abstractFactory.CreateSolutionsAbstractFactory().CreateHM1BSolutionFactory().Create().Solve( abstractFactory.CreateCalculationsAbstractFactory(), abstractFactory.CreateConstraintElementsAbstractFactory(), abstractFactory.CreateConstraintsAbstractFactory(), abstractFactory.CreateContextsAbstractFactory(), abstractFactory.CreateCrossJoinElementsAbstractFactory(), abstractFactory.CreateCrossJoinsAbstractFactory(), abstractFactory.CreateDependenciesAbstractFactory(), abstractFactory.CreateIndexElementsAbstractFactory(), abstractFactory.CreateIndicesAbstractFactory(), abstractFactory.CreateModelsAbstractFactory(), abstractFactory.CreateObjectiveFunctionsAbstractFactory(), abstractFactory.CreateParameterElementsAbstractFactory(), abstractFactory.CreateParametersAbstractFactory(), abstractFactory.CreateResultElementsAbstractFactory(), abstractFactory.CreateResultsAbstractFactory(), abstractFactory.CreateVariablesAbstractFactory(), HM1BConfiguration, HM1BInputContext, solverConfiguration, HM1BEncodingEnum)); }
public IHM1BConfiguration Create( Configuration configuration) { IHM1BConfiguration HM1BConfiguration = null; try { HM1BConfiguration = new HM1BConfiguration( configuration); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(HM1BConfiguration); }
public Task <IHM1BOutputContext> Solve( ICalculationsAbstractFactory calculationsAbstractFactory, IConstraintElementsAbstractFactory constraintElementsAbstractFactory, IConstraintsAbstractFactory constraintsAbstractFactory, IContextsAbstractFactory contextsAbstractFactory, ICrossJoinElementsAbstractFactory crossJoinElementsAbstractFactory, ICrossJoinsAbstractFactory crossJoinsAbstractFactory, IDependenciesAbstractFactory dependenciesAbstractFactory, IIndexElementsAbstractFactory indexElementsAbstractFactory, IIndicesAbstractFactory indicesAbstractFactory, IModelsAbstractFactory modelsAbstractFactory, IObjectiveFunctionsAbstractFactory objectiveFunctionsAbstractFactory, IParameterElementsAbstractFactory parameterElementsAbstractFactory, IParametersAbstractFactory parametersAbstractFactory, IResultElementsAbstractFactory resultElementsAbstractFactory, IResultsAbstractFactory resultsAbstractFactory, IVariablesAbstractFactory variablesAbstractFactory, IHM1BConfiguration HM1BConfiguration, IHM1BInputContext HM1BInputContext, ISolverConfiguration solverConfiguration, HM1BEncodingEnum HM1BEncodingEnum) { IHM1BOutputContext HM1BOutputContext = null; return(Task.Run(() => { using (ModelScope modelScope = dependenciesAbstractFactory.CreateModelScopeFactory().Create(HM1BConfiguration.Value)) { IHM1BModel model = modelsAbstractFactory.CreateHM1BModelFactory().Create( constraintElementsAbstractFactory, constraintsAbstractFactory, crossJoinElementsAbstractFactory, crossJoinsAbstractFactory, dependenciesAbstractFactory, indexElementsAbstractFactory, indicesAbstractFactory, objectiveFunctionsAbstractFactory, parameterElementsAbstractFactory, parametersAbstractFactory, variablesAbstractFactory, HM1BInputContext, HM1BEncodingEnum); using (ISolver solver = dependenciesAbstractFactory.CreateSolverFactory().Create(solverConfiguration)) { Solution solution = solver?.Solve(model?.Model); if (solution?.ModelStatus == OPTANO.Modeling.Optimization.Solver.ModelStatus.Feasible) { model.Model.VariableCollections.ForEach(vc => vc.SetVariableValues(solution.VariableValues)); HM1BOutputContext = contextsAbstractFactory.CreateHM1BOutputContextFactory().Create( calculationsAbstractFactory, dependenciesAbstractFactory, resultElementsAbstractFactory, resultsAbstractFactory, model, solution); } } } return HM1BOutputContext; })); }