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.7 KB
|
Line | |
---|
1 | using HeuristicLab.Core;
|
---|
2 | using HeuristicLab.Data;
|
---|
3 | using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base;
|
---|
4 | using HeuristicLab.Parameters;
|
---|
5 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers {
|
---|
8 |
|
---|
9 | [Item("GLPK", "GLPK (https://www.gnu.org/software/glpk/) can be used out of the box.")]
|
---|
10 | [StorableClass]
|
---|
11 | public class GlpkSolver : ExternalIncrementalSolver {
|
---|
12 |
|
---|
13 | public GlpkSolver() {
|
---|
14 | Parameters.Add(libraryNameParam = new FixedValueParameter<FileValue>(nameof(LibraryName),
|
---|
15 | new FileValue { FileDialogFilter = FileDialogFilter, Value = "glpk465.dll" }));
|
---|
16 |
|
---|
17 | programmingTypeParam.Value.ValueChanged += (sender, args) => {
|
---|
18 | if (((EnumValue<LinearProgrammingType>)sender).Value == LinearProgrammingType.LinearProgramming) {
|
---|
19 | incrementalityParam.Value = new BoolValue(true);
|
---|
20 | incrementalityParam.Value.ValueChanged += (s, a) => {
|
---|
21 | if (((BoolValue)s).Value) {
|
---|
22 | qualityUpdateIntervalParam.Value = new TimeSpanValue(qualityUpdateIntervalParam.Value.Value);
|
---|
23 | } else {
|
---|
24 | qualityUpdateIntervalParam.Value = (TimeSpanValue)qualityUpdateIntervalParam.Value.AsReadOnly();
|
---|
25 | }
|
---|
26 | };
|
---|
27 | } else {
|
---|
28 | incrementalityParam.Value = (BoolValue)new BoolValue().AsReadOnly();
|
---|
29 | }
|
---|
30 | };
|
---|
31 | }
|
---|
32 |
|
---|
33 | public override OptimizationProblemType OptimizationProblemType =>
|
---|
34 | LinearProgrammingType == LinearProgrammingType.LinearProgramming
|
---|
35 | ? OptimizationProblemType.GLPK_LINEAR_PROGRAMMING
|
---|
36 | : OptimizationProblemType.GLPK_MIXED_INTEGER_PROGRAMMING;
|
---|
37 | }
|
---|
38 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.