Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/CoinOrSolver.cs @ 16233

Last change on this file since 16233 was 16233, checked in by ddorfmei, 6 years ago

#2931:

  • added all available parameters OR-Tools's linear_solver to LinearProgrammingAlgorithm
    • added necessary parameter enums
  • moved solving logic to Solver
    • created IncrementalSolver, ExternalSolver, ExternalIncrementalSolver
    • added logic for solvers that can be stopped and resumed
  • added SupportsStop property to BasicAlgorithm
  • added quality per time chart for incremental solvers
File size: 1.5 KB
Line 
1using HeuristicLab.Core;
2using HeuristicLab.Data;
3using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base;
4using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
5
6namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers {
7
8  [Item("Clp/Cbc", "Clp (https://projects.coin-or.org/Clp) and Cbc (https://projects.coin-or.org/Cbc) can be used out of the box.")]
9  [StorableClass]
10  public class CoinOrSolver : IncrementalSolver {
11
12    public CoinOrSolver() {
13      programmingTypeParam.Value.ValueChanged += (sender, args) => {
14        if (((EnumValue<LinearProgrammingType>)sender).Value == LinearProgrammingType.LinearProgramming) {
15          incrementalityParam.Value = new BoolValue(true);
16          incrementalityParam.Value.ValueChanged += (s, a) => {
17            if (((BoolValue)s).Value) {
18              qualityUpdateIntervalParam.Value = new TimeSpanValue(qualityUpdateIntervalParam.Value.Value);
19            } else {
20              qualityUpdateIntervalParam.Value = (TimeSpanValue)qualityUpdateIntervalParam.Value.AsReadOnly();
21            }
22          };
23        } else {
24          incrementalityParam.Value = (BoolValue)new BoolValue().AsReadOnly();
25        }
26      };
27    }
28
29    public override OptimizationProblemType OptimizationProblemType =>
30      LinearProgrammingType == LinearProgrammingType.LinearProgramming
31        ? OptimizationProblemType.CLP_LINEAR_PROGRAMMING
32        : OptimizationProblemType.CBC_MIXED_INTEGER_PROGRAMMING;
33  }
34}
Note: See TracBrowser for help on using the repository browser.