Changeset 16233 for branches/2931_OR-Tools_LP_MIP
- Timestamp:
- 10/17/18 17:51:26 (6 years ago)
- Location:
- branches/2931_OR-Tools_LP_MIP
- Files:
-
- 11 added
- 16 edited
- 9 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/2931_OR-Tools_LP_MIP/HeuristicLab.ExtLibs/HeuristicLab.OrTools/6.9.0-pre/HeuristicLab.OrTools-6.9.0-pre/HeuristicLab.OrTools-6.9.0-pre.csproj
r16172 r16233 113 113 </ItemGroup> 114 114 <ItemGroup> 115 <Content Include=" GLPK-4.65-license.txt">115 <Content Include="glpk-license.txt"> 116 116 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 117 117 </Content> … … 128 128 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 129 129 </Content> 130 <Content Include="Google.OrTools.runtime.win-x64.dll"> 131 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 132 </Content> 130 133 <Content Include="Google.OrTools_version.txt"> 131 134 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 132 135 </Content> 133 136 <Content Include="Google.Protobuf.dll"> 134 <CopyToOutputDirectory>Always</CopyToOutputDirectory>135 </Content>136 <Content Include="runtime.win-x64.Google.OrTools.dll">137 137 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 138 138 </Content> -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.ExtLibs/HeuristicLab.OrTools/6.9.0-pre/HeuristicLab.OrTools-6.9.0-pre/Plugin.cs.frame
r16172 r16233 28 28 [PluginFile("Google.OrTools.dll", PluginFileType.Assembly)] 29 29 [PluginFile("Google.OrTools-license.txt", PluginFileType.License)] 30 [PluginFile(" runtime.win-x64.Google.OrTools.dll", PluginFileType.NativeDll)]30 [PluginFile("Google.OrTools.runtime.win-x64.dll", PluginFileType.NativeDll)] 31 31 [PluginFile("Google.OrTools_version.txt", PluginFileType.Data)] 32 32 [PluginFile("glpk_4_65.dll", PluginFileType.NativeDll)] 33 [PluginFile(" GLPK-4.65-license.txt", PluginFileType.License)]33 [PluginFile("glpk-license.txt", PluginFileType.License)] 34 34 public class HeuristicLabOrToolsPlugin : PluginBase { 35 35 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.ExtLibs/HeuristicLab.OrTools/6.9.0-pre/HeuristicLab.OrTools-6.9.0-pre/Properties/AssemblyInfo.cs
r16172 r16233 54 54 // [assembly: AssemblyVersion("1.0.*")] 55 55 [assembly: AssemblyVersion("6.8.0.0")] 56 [assembly: AssemblyFileVersion("6.8.0.161 38")]56 [assembly: AssemblyFileVersion("6.8.0.16172")] -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/HeuristicLab.MathematicalOptimization-3.3.csproj
r16172 r16233 131 131 </ItemGroup> 132 132 <ItemGroup> 133 <Compile Include="LinearProgramming\Algorithms\BopSolver.cs" /> 134 <Compile Include="LinearProgramming\Algorithms\CoinOrSolver.cs" /> 135 <Compile Include="LinearProgramming\Algorithms\GlopSolver.cs" /> 136 <Compile Include="LinearProgramming\Algorithms\GlpkSolver.cs" /> 133 <Compile Include="LinearProgramming\Algorithms\Solvers\BopSolver.cs" /> 134 <Compile Include="LinearProgramming\Algorithms\Solvers\CoinOrSolver.cs" /> 135 <Compile Include="LinearProgramming\Algorithms\Solvers\Base\ExternalSolver.cs" /> 136 <Compile Include="LinearProgramming\Algorithms\Solvers\GlopSolver.cs" /> 137 <Compile Include="LinearProgramming\Algorithms\Solvers\GlpkSolver.cs" /> 138 <Compile Include="LinearProgramming\Algorithms\Solvers\Base\IExternalSolver.cs" /> 139 <Compile Include="LinearProgramming\Algorithms\Solvers\Base\IIncrementalSolver.cs" /> 140 <Compile Include="LinearProgramming\Algorithms\Solvers\Base\ExternalIncrementalSolver.cs" /> 141 <Compile Include="LinearProgramming\Algorithms\Solvers\Base\IncrementalSolver.cs" /> 137 142 <Compile Include="LinearProgramming\Algorithms\LinearProgrammingType.cs" /> 138 <Compile Include="LinearProgramming\Algorithms\S cipSolver.cs" />143 <Compile Include="LinearProgramming\Algorithms\Solvers\ScipSolver.cs" /> 139 144 <Compile Include="LinearProgramming\BasisStatus.cs" /> 140 <Compile Include="LinearProgramming\Algorithms\CplexSolver.cs" /> 141 <Compile Include="LinearProgramming\Algorithms\GurobiSolver.cs" /> 142 <Compile Include="LinearProgramming\Algorithms\ISolver.cs" /> 145 <Compile Include="LinearProgramming\Algorithms\Solvers\CplexSolver.cs" /> 146 <Compile Include="LinearProgramming\Algorithms\Solvers\GurobiSolver.cs" /> 147 <Compile Include="LinearProgramming\Algorithms\Solvers\Base\ISolver.cs" /> 148 <Compile Include="LinearProgramming\IncrementalityValues.cs" /> 149 <Compile Include="LinearProgramming\IntegerParam.cs" /> 150 <Compile Include="LinearProgramming\LpAlgorithmValues.cs" /> 143 151 <Compile Include="LinearProgramming\Problems\ILinearProgrammingProblemDefinition.cs" /> 144 152 <Compile Include="LinearProgramming\Algorithms\LinearProgrammingAlgorithm.cs" /> … … 149 157 <Compile Include="LinearProgramming\OptimizationProblemType.cs" /> 150 158 <Compile Include="LinearProgramming\Problems\ProblemDefinitionScriptException.cs" /> 151 <Compile Include="LinearProgramming\Algorithms\Solver.cs" /> 159 <Compile Include="LinearProgramming\Algorithms\Solvers\Base\Solver.cs" /> 160 <Compile Include="LinearProgramming\DoubleParam.cs" /> 152 161 <Compile Include="LinearProgramming\Views\LinearProgrammingProblemDefinitionScriptView.cs"> 153 162 <SubType>UserControl</SubType> … … 179 188 </ItemGroup> 180 189 <ItemGroup> 190 <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj"> 191 <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project> 192 <Name>HeuristicLab.Analysis-3.3</Name> 193 </ProjectReference> 181 194 <ProjectReference Include="..\..\HeuristicLab.Clients.OKB\3.3\HeuristicLab.Clients.OKB-3.3.csproj"> 182 195 <Project>{73857A9C-9706-4B72-8D9C-210B5B6A5691}</Project> -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/LinearProgrammingAlgorithm.cs
r16172 r16233 1 1 using System; 2 2 using System.Threading; 3 using Google.OrTools.LinearSolver; 3 4 using HeuristicLab.Common; 4 5 using HeuristicLab.Core; 5 6 using HeuristicLab.Data; 7 using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers; 8 using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base; 6 9 using HeuristicLab.MathematicalOptimization.LinearProgramming.Problems; 7 10 using HeuristicLab.Optimization; … … 10 13 11 14 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms { 12 [Item("Linear Programming Algorithm", "")] 13 [Creatable(CreatableAttribute.Categories.Algorithms, Priority = 162)] 15 16 [Item("Linear/Mixed Integer Programming (LP/MIP)", "")] 17 [Creatable(CreatableAttribute.Categories.SingleSolutionAlgorithms)] 14 18 [StorableClass] 15 19 public class LinearProgrammingAlgorithm : BasicAlgorithm { 20 21 [Storable] 22 private readonly IFixedValueParameter<DoubleValue> dualToleranceParam; 23 24 [Storable] 25 private readonly IFixedValueParameter<EnumValue<LpAlgorithmValues>> lpAlgorithmParam; 26 27 [Storable] 28 private readonly IFixedValueParameter<BoolValue> presolveParam; 29 30 [Storable] 31 private readonly IFixedValueParameter<DoubleValue> primalToleranceParam; 32 33 [Storable] 34 private readonly IFixedValueParameter<DoubleValue> relativeGapToleranceParam; 35 36 [Storable] 37 private readonly IFixedValueParameter<BoolValue> scalingParam; 16 38 17 39 [Storable] … … 19 41 20 42 [Storable] 21 private readonly IFixedValueParameter<DoubleValue> relativeGapToleranceParam;22 23 [Storable]24 43 private readonly IFixedValueParameter<TimeSpanValue> timeLimitParam; 25 44 26 45 public LinearProgrammingAlgorithm() { 27 Parameters.Add(solverParam = new ConstrainedValueParameter<ISolver>(nameof(Solver))); 28 Parameters.Add(relativeGapToleranceParam = new FixedValueParameter<DoubleValue>(nameof(RelativeGapTolerance), new DoubleValue())); 29 Parameters.Add(timeLimitParam = new FixedValueParameter<TimeSpanValue>(nameof(TimeLimit), new TimeSpanValue())); 46 Parameters.Add(solverParam = 47 new ConstrainedValueParameter<ISolver>(nameof(Solver), "The solver used to solve the model.")); 48 Parameters.Add(relativeGapToleranceParam = new FixedValueParameter<DoubleValue>(nameof(RelativeGapTolerance), 49 "Limit for relative MIP gap.", new DoubleValue(MPSolverParameters.kDefaultRelativeMipGap))); 50 Parameters.Add(timeLimitParam = new FixedValueParameter<TimeSpanValue>(nameof(TimeLimit), 51 "Limit for runtime. Set to zero for unlimited runtime.", new TimeSpanValue())); 52 Parameters.Add(presolveParam = 53 new FixedValueParameter<BoolValue>(nameof(Presolve), "Advanced usage: presolve mode.", new BoolValue())); 54 Parameters.Add(lpAlgorithmParam = new FixedValueParameter<EnumValue<LpAlgorithmValues>>(nameof(LpAlgorithm), 55 "Algorithm to solve linear programs.", new EnumValue<LpAlgorithmValues>(LpAlgorithmValues.DualSimplex))); 56 Parameters.Add(dualToleranceParam = new FixedValueParameter<DoubleValue>(nameof(DualTolerance), 57 "Advanced usage: tolerance for dual feasibility of basic solutions.", 58 new DoubleValue(MPSolverParameters.kDefaultDualTolerance))); 59 Parameters.Add(primalToleranceParam = new FixedValueParameter<DoubleValue>(nameof(PrimalTolerance), 60 "Advanced usage: tolerance for primal feasibility of basic solutions. " + 61 "This does not control the integer feasibility tolerance of integer " + 62 "solutions for MIP or the tolerance used during presolve.", 63 new DoubleValue(MPSolverParameters.kDefaultPrimalTolerance))); 64 Parameters.Add(scalingParam = new FixedValueParameter<BoolValue>(nameof(Scaling), 65 "Advanced usage: enable or disable matrix scaling.", new BoolValue())); 30 66 31 67 Problem = new LinearProgrammingProblem(); … … 42 78 [StorableConstructor] 43 79 private LinearProgrammingAlgorithm(bool deserializing) 44 : base(deserializing) { } 80 : base(deserializing) { 81 } 45 82 46 83 private LinearProgrammingAlgorithm(LinearProgrammingAlgorithm original, Cloner cloner) … … 49 86 relativeGapToleranceParam = cloner.Clone(original.relativeGapToleranceParam); 50 87 timeLimitParam = cloner.Clone(original.timeLimitParam); 88 presolveParam = cloner.Clone(original.presolveParam); 89 lpAlgorithmParam = cloner.Clone(original.lpAlgorithmParam); 90 dualToleranceParam = cloner.Clone(original.dualToleranceParam); 91 primalToleranceParam = cloner.Clone(original.primalToleranceParam); 92 scalingParam = cloner.Clone(original.scalingParam); 51 93 } 52 94 53 public ISolver Solver { 54 get => solverParam.Value; 55 set => solverParam.Value = value; 95 public double DualTolerance { 96 get => dualToleranceParam.Value.Value; 97 set => dualToleranceParam.Value.Value = value; 98 } 99 100 public LpAlgorithmValues LpAlgorithm { 101 get => lpAlgorithmParam.Value.Value; 102 set => lpAlgorithmParam.Value.Value = value; 103 } 104 105 public bool Presolve { 106 get => presolveParam.Value.Value; 107 set => presolveParam.Value.Value = value; 108 } 109 110 public double PrimalTolerance { 111 get => primalToleranceParam.Value.Value; 112 set => primalToleranceParam.Value.Value = value; 56 113 } 57 114 … … 62 119 63 120 public override Type ProblemType { get; } = typeof(LinearProgrammingProblem); 121 64 122 public double RelativeGapTolerance { 65 123 get => relativeGapToleranceParam.Value.Value; … … 69 127 public override ResultCollection Results { get; } = new ResultCollection(); 70 128 71 public override bool SupportsPause { get; } = false; 129 public bool Scaling { 130 get => scalingParam.Value.Value; 131 set => scalingParam.Value.Value = value; 132 } 133 134 public ISolver Solver { 135 get => solverParam.Value; 136 set => solverParam.Value = value; 137 } 138 139 public override bool SupportsPause => Solver.SupportsPause; 140 141 public override bool SupportsStop => Solver.SupportsStop; 72 142 73 143 public TimeSpan TimeLimit { … … 77 147 78 148 public override IDeepCloneable Clone(Cloner cloner) => new LinearProgrammingAlgorithm(this, cloner); 79 protected override void Run(CancellationToken cancellationToken) {80 using (var solver = LinearSolver.CreateSolver(Solver.OptimizationProblemType, Name,81 Solver.LibraryName ?? string.Empty, s => Problem.ProblemDefinition.BuildModel(s))) {82 solver.RelativeGapTolerance = RelativeGapTolerance;83 solver.TimeLimit = TimeLimit;84 149 85 solver.Solve(); 150 public override void Pause() { 151 base.Pause(); 152 Solver.Interrupt(); 153 } 86 154 87 Problem.ProblemDefinition.Analyze(solver.Solver, Results); 88 Results.AddOrUpdateResult("Result Status", new EnumValue<ResultStatus>(solver.ResultStatus)); 89 Results.AddOrUpdateResult("Best Objective Value", new DoubleValue(solver.ObjectiveValue ?? double.NaN)); 90 Results.AddOrUpdateResult("Absolute Gap", new DoubleValue(solver.AbsoluteGap ?? double.NaN)); 91 Results.AddOrUpdateResult("Relative Gap", new DoubleValue(solver.RelativeGap ?? double.NaN)); 92 Results.AddOrUpdateResult("Number of Constraints", new IntValue(solver.NumberOfConstraints)); 93 Results.AddOrUpdateResult("Number of Variables", new IntValue(solver.NumberOfVariables)); 94 Results.AddOrUpdateResult("Number of Nodes", new DoubleValue(solver.NumberOfNodes)); 95 Results.AddOrUpdateResult("Iterations", new DoubleValue(solver.Iterations)); 155 public override void Prepare() { 156 base.Prepare(); 157 Results.Clear(); 158 159 foreach (var solver in solverParam.ValidValues) { 160 solver.Reset(); 96 161 } 97 162 } 163 164 public override void Stop() { 165 base.Stop(); 166 Solver.Interrupt(); 167 } 168 protected override void Initialize(CancellationToken cancellationToken) { 169 base.Initialize(cancellationToken); 170 } 171 protected override void Run(CancellationToken cancellationToken) => Solver.Solve(this, cancellationToken); 98 172 } 99 173 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/LinearProgrammingType.cs
r16172 r16233 1 1 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms { 2 2 3 public enum LinearProgrammingType { 3 4 LinearProgramming, -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/Base/ISolver.cs
r16232 r16233 1 using HeuristicLab.Core; 1 using System.Threading; 2 using HeuristicLab.Core; 2 3 3 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms { 4 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base { 5 4 6 public interface ISolver : IParameterizedNamedItem { 7 LinearProgrammingType LinearProgrammingType { get; set; } 5 8 OptimizationProblemType OptimizationProblemType { get; } 6 string LibraryName { get; set; } 7 LinearProgrammingType LinearProgrammingType { get; set; } 9 bool SupportsPause { get; } 10 bool SupportsStop { get; } 11 12 void Interrupt(); 13 14 void Reset(); 15 16 void Solve(LinearProgrammingAlgorithm algorithm); 17 18 void Solve(LinearProgrammingAlgorithm algorithm, CancellationToken cancellationToken); 8 19 } 9 20 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/Base/Solver.cs
r16232 r16233 1 using HeuristicLab.Common; 1 using System; 2 using System.Threading; 3 using HeuristicLab.Common; 2 4 using HeuristicLab.Core; 3 5 using HeuristicLab.Data; … … 5 7 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 6 8 7 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {9 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base { 8 10 9 public class Solver : ParameterizedNamedItem, ISolver { 11 [StorableClass] 12 public class Solver : ParameterizedNamedItem, ISolver, IDisposable { 10 13 11 14 [Storable] 12 protected I FixedValueParameter<StringValue> libraryNameParam;15 protected IValueParameter<EnumValue<LinearProgrammingType>> programmingTypeParam; 13 16 14 15 [Storable] 16 protected IFixedValueParameter<EnumValue<LinearProgrammingType>> programmingTypeParam; 17 protected LinearSolver solver; 17 18 18 19 public Solver() { 19 // Parameters.Add(useMixedIntegerProgrammingParam = new FixedValueParameter<BoolValue>(nameof(UseMixedIntegerProgramming), (BoolValue)new BoolValue(false).AsReadOnly())); 20 Parameters.Add(programmingTypeParam = new FixedValueParameter<EnumValue<LinearProgrammingType>>(nameof(LinearProgrammingType), new EnumValue<LinearProgrammingType>())); 20 Parameters.Add(programmingTypeParam = 21 new ValueParameter<EnumValue<LinearProgrammingType>>(nameof(LinearProgrammingType), 22 new EnumValue<LinearProgrammingType>())); 21 23 } 22 24 23 25 [StorableConstructor] 24 26 protected Solver(bool deserializing) 25 : base(deserializing) { } 27 : base(deserializing) { 28 } 26 29 27 30 protected Solver(Solver original, Cloner cloner) 28 31 : base(original, cloner) { 29 libraryNameParam = cloner.Clone(original.libraryNameParam);30 32 programmingTypeParam = cloner.Clone(original.programmingTypeParam); 31 33 } 32 33 public string LibraryName {34 get => libraryNameParam?.Value.Value;35 set => libraryNameParam.Value.Value = value;36 }37 38 public virtual OptimizationProblemType OptimizationProblemType { get; }39 34 40 35 public LinearProgrammingType LinearProgrammingType { … … 43 38 } 44 39 40 public virtual OptimizationProblemType OptimizationProblemType { get; } 41 public virtual bool SupportsPause => false; 42 public virtual bool SupportsStop => false; 43 45 44 public override IDeepCloneable Clone(Cloner cloner) => new Solver(this, cloner); 45 46 public void Dispose() => solver?.Dispose(); 47 48 public void Interrupt() => solver.Stop(); 49 50 public virtual void Reset() { 51 solver = null; 52 } 53 54 public virtual void Solve(LinearProgrammingAlgorithm algorithm, CancellationToken cancellationToken) => 55 Solve(algorithm, CancellationToken.None); 56 57 public virtual void Solve(LinearProgrammingAlgorithm algorithm) => 58 Solve(algorithm, algorithm.TimeLimit, false); 59 60 public virtual void Solve(LinearProgrammingAlgorithm algorithm, TimeSpan timeLimit, bool incrementality) { 61 var libraryName = string.Empty; 62 if (this is ExternalSolver externalSolver) 63 libraryName = externalSolver.LibraryName; 64 65 if (solver == null) { 66 solver = LinearSolver.CreateSolver(OptimizationProblemType, Name, 67 libraryName, s => algorithm.Problem.ProblemDefinition.BuildModel(s)); 68 } 69 70 solver.TimeLimit = timeLimit; 71 solver.RelativeGapTolerance = algorithm.RelativeGapTolerance; 72 solver.PrimalTolerance = algorithm.PrimalTolerance; 73 solver.DualTolerance = algorithm.DualTolerance; 74 solver.Presolve = algorithm.Presolve; 75 solver.Scaling = algorithm.Scaling; 76 solver.LpAlgorithm = algorithm.LpAlgorithm; 77 solver.Incrementality = incrementality; 78 79 solver.Solve(); 80 81 algorithm.Problem.ProblemDefinition.Analyze(solver.Solver, algorithm.Results); 82 algorithm.Results.AddOrUpdateResult("Result Status", new EnumValue<ResultStatus>(solver.ResultStatus)); 83 algorithm.Results.AddOrUpdateResult("Best Objective Value", 84 new DoubleValue(solver.ObjectiveValue ?? double.NaN)); 85 algorithm.Results.AddOrUpdateResult("Best Objective Bound", 86 new DoubleValue(solver.ObjectiveBound ?? double.NaN)); 87 algorithm.Results.AddOrUpdateResult("Absolute Gap", new DoubleValue(solver.AbsoluteGap ?? double.NaN)); 88 algorithm.Results.AddOrUpdateResult("Relative Gap", new DoubleValue(solver.RelativeGap ?? double.NaN)); 89 algorithm.Results.AddOrUpdateResult("Number of Constraints", new IntValue(solver.NumberOfConstraints)); 90 algorithm.Results.AddOrUpdateResult("Number of Variables", new IntValue(solver.NumberOfVariables)); 91 algorithm.Results.AddOrUpdateResult("Number of Nodes", new DoubleValue(solver.NumberOfNodes)); 92 algorithm.Results.AddOrUpdateResult("Iterations", new DoubleValue(solver.Iterations)); 93 algorithm.Results.AddOrUpdateResult("Solver Version", new StringValue(solver.SolverVersion)); 94 algorithm.Results.AddOrUpdateResult("Wall Time", new TimeSpanValue(solver.WallTime ?? TimeSpan.Zero)); 95 } 46 96 } 47 97 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/BopSolver.cs
r16232 r16233 1 1 using HeuristicLab.Core; 2 using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base; 2 3 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 3 4 4 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms { 5 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers { 6 5 7 [Item("BOP", "BOP (https://developers.google.com/optimization/reference/bop/bop_solver/) can be used out of the box.")] 6 8 [StorableClass] 7 public class BopSolver : Solver {9 public class BopSolver : IncrementalSolver { 8 10 9 11 public BopSolver() { … … 12 14 13 15 public override OptimizationProblemType OptimizationProblemType => OptimizationProblemType.BOP_INTEGER_PROGRAMMING; 16 public override bool SupportsPause => true; 17 public override bool SupportsStop => true; 14 18 } 15 19 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/CoinOrSolver.cs
r16232 r16233 1 1 using HeuristicLab.Core; 2 using HeuristicLab.Data; 3 using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base; 2 4 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 3 5 4 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms { 6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers { 7 5 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.")] 6 9 [StorableClass] 7 public class CoinOrSolver : Solver { 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 } 8 28 9 29 public override OptimizationProblemType OptimizationProblemType => -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/CplexSolver.cs
r16232 r16233 1 1 using HeuristicLab.Core; 2 2 using HeuristicLab.Data; 3 using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base; 3 4 using HeuristicLab.Parameters; 4 5 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 5 6 6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {7 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers { 7 8 8 9 [Item("CPLEX", "CPLEX (https://www.ibm.com/analytics/cplex-optimizer) must be installed and licenced.")] 9 10 [StorableClass] 10 public class CplexSolver : Solver {11 public class CplexSolver : ExternalIncrementalSolver { 11 12 12 13 public CplexSolver() { 13 Parameters.Add(libraryNameParam = new FixedValueParameter<StringValue>(nameof(LibraryName), new StringValue("cplex1280.dll"))); 14 Parameters.Add(libraryNameParam = new FixedValueParameter<FileValue>(nameof(LibraryName), 15 new FileValue { FileDialogFilter = FileDialogFilter, Value = "cplex1280.dll" })); 14 16 } 15 17 -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/GlopSolver.cs
r16232 r16233 1 1 using HeuristicLab.Core; 2 2 using HeuristicLab.Data; 3 using HeuristicLab. Parameters;3 using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base; 4 4 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 5 5 6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms { 6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers { 7 7 8 [Item("Glop", "Glop (https://developers.google.com/optimization/lp/glop) can be used out of the box.")] 8 9 [StorableClass] 9 public class GlopSolver : Solver {10 public class GlopSolver : IncrementalSolver { 10 11 11 12 public GlopSolver() { 12 Parameters.Remove(programmingTypeParam); 13 Parameters.Add(programmingTypeParam = new FixedValueParameter<EnumValue<LinearProgrammingType>>(nameof(LinearProgrammingType), 14 (EnumValue<LinearProgrammingType>)new EnumValue<LinearProgrammingType>().AsReadOnly())); 13 programmingTypeParam.Value = (EnumValue<LinearProgrammingType>)programmingTypeParam.Value.AsReadOnly(); 15 14 } 16 15 17 16 public override OptimizationProblemType OptimizationProblemType => OptimizationProblemType.GLOP_LINEAR_PROGRAMMING; 17 public override bool SupportsPause => true; 18 public override bool SupportsStop => true; 18 19 } 19 20 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/GlpkSolver.cs
r16232 r16233 1 1 using HeuristicLab.Core; 2 2 using HeuristicLab.Data; 3 using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base; 3 4 using HeuristicLab.Parameters; 4 5 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 5 6 6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms { 7 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers { 8 7 9 [Item("GLPK", "GLPK (https://www.gnu.org/software/glpk/) can be used out of the box.")] 8 10 [StorableClass] 9 public class GlpkSolver : Solver {11 public class GlpkSolver : ExternalIncrementalSolver { 10 12 11 13 public GlpkSolver() { 12 Parameters.Add(libraryNameParam = new FixedValueParameter<StringValue>(nameof(LibraryName), new StringValue("glpk_4_65.dll"))); 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 }; 13 31 } 14 32 -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/GurobiSolver.cs
r16232 r16233 1 using HeuristicLab.Core; 1 using HeuristicLab.Common; 2 using HeuristicLab.Core; 2 3 using HeuristicLab.Data; 4 using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base; 3 5 using HeuristicLab.Parameters; 4 6 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 5 7 6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms { 8 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers { 9 7 10 [Item("Gurobi", "Gurobi (http://www.gurobi.com/) must be installed and licenced.")] 8 11 [StorableClass] 9 public class GurobiSolver : Solver {12 public class GurobiSolver : ExternalIncrementalSolver { 10 13 11 14 public GurobiSolver() { 12 Parameters.Add(libraryNameParam = new FixedValueParameter<StringValue>(nameof(LibraryName), new StringValue("gurobi80.dll"))); 15 Parameters.Add(libraryNameParam = new FixedValueParameter<FileValue>(nameof(LibraryName), 16 new FileValue { FileDialogFilter = FileDialogFilter, Value = "gurobi80.dll" })); 17 } 18 19 protected GurobiSolver(GurobiSolver original, Cloner cloner) 20 : base(original, cloner) { 21 programmingTypeParam = cloner.Clone(original.programmingTypeParam); 13 22 } 14 23 … … 17 26 ? OptimizationProblemType.GUROBI_LINEAR_PROGRAMMING 18 27 : OptimizationProblemType.GUROBI_MIXED_INTEGER_PROGRAMMING; 28 29 public override bool SupportsPause => true; 30 public override bool SupportsStop => true; 19 31 } 20 32 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/ScipSolver.cs
r16232 r16233 1 1 using HeuristicLab.Core; 2 2 using HeuristicLab.Data; 3 using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base; 3 4 using HeuristicLab.Parameters; 4 5 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 5 6 6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms { 7 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers { 8 7 9 [Item("SCIP", "SCIP (http://scip.zib.de/) must be installed and licenced.")] 8 10 [StorableClass] 9 public class ScipSolver : Solver {11 public class ScipSolver : ExternalSolver { 10 12 11 13 public ScipSolver() { 12 Parameters.Add(libraryNameParam = new FixedValueParameter<StringValue>(nameof(LibraryName), new StringValue("scip.dll"))); 13 Parameters.Remove(programmingTypeParam); 14 Parameters.Add(programmingTypeParam = new FixedValueParameter<EnumValue<LinearProgrammingType>>(nameof(LinearProgrammingType), 15 (EnumValue<LinearProgrammingType>)new EnumValue<LinearProgrammingType>(LinearProgrammingType.MixedIntegerProgramming).AsReadOnly())); 14 Parameters.Add(libraryNameParam = new FixedValueParameter<FileValue>(nameof(LibraryName), 15 new FileValue { FileDialogFilter = FileDialogFilter, Value = "scip.dll" })); 16 programmingTypeParam.Value = 17 (EnumValue<LinearProgrammingType>)new EnumValue<LinearProgrammingType>(LinearProgrammingType 18 .MixedIntegerProgramming).AsReadOnly(); 16 19 } 17 20 18 21 public override OptimizationProblemType OptimizationProblemType => 19 22 OptimizationProblemType.SCIP_MIXED_INTEGER_PROGRAMMING; 23 24 public override bool SupportsPause => true; 25 public override bool SupportsStop => true; 20 26 } 21 27 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Problems/ILinearProgrammingProblemDefinition.cs
r16172 r16233 1 1 #region License Information 2 2 3 /* HeuristicLab 3 4 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) … … 18 19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 20 */ 20 #endregion 21 22 #endregion License Information 21 23 22 24 using Google.OrTools.LinearSolver; … … 24 26 25 27 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Problems { 28 26 29 public interface ILinearProgrammingProblemDefinition { 30 27 31 void BuildModel(Solver solver); 32 28 33 void Analyze(Solver solver, ResultCollection results); 29 34 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Problems/LinearProgrammingProblem.cs
r16172 r16233 1 1 #region License Information 2 2 3 /* HeuristicLab 3 4 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) … … 18 19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 20 */ 20 #endregion 21 22 #endregion License Information 21 23 22 24 using System.Drawing; … … 30 32 31 33 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Problems { 32 [Item("Linear Programming Programmable Problem (single-objective)", "Represents a single-objective problem that can be programmed with a script.")] 33 [Creatable(CreatableAttribute.Categories.Problems, Priority = 100)] 34 35 [Item("Linear/Mixed Integer Programming Problem (LP/MIP)", "")] 36 [Creatable(CreatableAttribute.Categories.CombinatorialProblems)] 34 37 [StorableClass] 35 38 public class LinearProgrammingProblem : Problem, IProgrammableItem { 36 39 37 public new static Image StaticItemImage => VSImageLibrary.Script; 38 39 private FixedValueParameter<LinearProgrammingProblemDefinitionScript> LinearProgrammingProblemScriptParameter => (FixedValueParameter<LinearProgrammingProblemDefinitionScript>)Parameters["ProblemScript"]; 40 41 public LinearProgrammingProblemDefinitionScript ProblemScript => LinearProgrammingProblemScriptParameter.Value; 42 43 public ILinearProgrammingProblemDefinition ProblemDefinition => LinearProgrammingProblemScriptParameter.Value; 40 public LinearProgrammingProblem() { 41 Parameters.Add(new FixedValueParameter<LinearProgrammingProblemDefinitionScript>("ProblemScript", 42 "Defines the problem.", new LinearProgrammingProblemDefinitionScript { Name = Name }) { GetsCollected = false }); 43 RegisterEvents(); 44 } 44 45 45 46 private LinearProgrammingProblem(LinearProgrammingProblem original, Cloner cloner) … … 47 48 RegisterEvents(); 48 49 } 49 public override IDeepCloneable Clone(Cloner cloner) { return new LinearProgrammingProblem(this, cloner); }50 50 51 51 [StorableConstructor] 52 52 private LinearProgrammingProblem(bool deserializing) : base(deserializing) { } 53 public LinearProgrammingProblem() { 54 Parameters.Add(new FixedValueParameter<LinearProgrammingProblemDefinitionScript>("ProblemScript", "Defines the problem.", new LinearProgrammingProblemDefinitionScript { Name = Name }) { GetsCollected = false }); 55 //Operators.Add(new BestScopeSolutionAnalyzer()); 56 RegisterEvents(); 53 54 public new static Image StaticItemImage => VSImageLibrary.Script; 55 public ILinearProgrammingProblemDefinition ProblemDefinition => LinearProgrammingProblemScriptParameter.Value; 56 public LinearProgrammingProblemDefinitionScript ProblemScript => LinearProgrammingProblemScriptParameter.Value; 57 58 private FixedValueParameter<LinearProgrammingProblemDefinitionScript> LinearProgrammingProblemScriptParameter => 59 (FixedValueParameter<LinearProgrammingProblemDefinitionScript>)Parameters["ProblemScript"]; 60 61 public void BuildModel(Solver solver) => ProblemDefinition.BuildModel(solver); 62 63 public override IDeepCloneable Clone(Cloner cloner) { 64 return new LinearProgrammingProblem(this, cloner); 65 } 66 67 protected override void OnNameChanged() { 68 base.OnNameChanged(); 69 ProblemScript.Name = Name; 57 70 } 58 71 … … 62 75 } 63 76 77 private void OnProblemDefinitionChanged() { 78 OnOperatorsChanged(); 79 OnReset(); 80 } 81 82 private void OnProblemScriptNameChanged() { 83 Name = ProblemScript.Name; 84 } 85 64 86 private void RegisterEvents() { 65 87 ProblemScript.ProblemDefinitionChanged += (o, e) => OnProblemDefinitionChanged(); 66 88 ProblemScript.NameChanged += (o, e) => OnProblemScriptNameChanged(); 67 89 } 68 69 private void OnProblemDefinitionChanged() {70 //Parameters.Remove("Maximization");71 //Parameters.Add(new FixedValueParameter<BoolValue>("Maximization", "Set to false if the problem should be minimized.", (BoolValue)new BoolValue(Maximization).AsReadOnly()) { Hidden = true });72 73 //Encoding = ProblemDefinition.Encoding;74 OnOperatorsChanged();75 OnReset();76 }77 protected override void OnNameChanged() {78 base.OnNameChanged();79 ProblemScript.Name = Name;80 }81 private void OnProblemScriptNameChanged() {82 Name = ProblemScript.Name;83 }84 85 public void BuildModel(Solver solver) => ProblemDefinition.BuildModel(solver);86 87 //public override bool Maximization {88 // get { return Parameters.ContainsKey("ProblemScript") ? ProblemDefinition.Maximization : false; }89 //}90 91 //public override double Evaluate(Individual individual, IRandom random) {92 // return ProblemDefinition.Evaluate(individual, random);93 //}94 95 //public override void Analyze(Individual[] individuals, double[] qualities, ResultCollection results, IRandom random) {96 // ProblemDefinition.Analyze(individuals, qualities, results, random);97 //}98 99 //public override IEnumerable<Individual> GetNeighbors(Individual individual, IRandom random) {100 // return ProblemDefinition.GetNeighbors(individual, random);101 //}102 90 } 103 91 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Problems/LinearProgrammingProblemDefinitionScript.cs
r16172 r16233 1 1 #region License Information 2 2 3 /* HeuristicLab 3 4 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) … … 18 19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 20 */ 20 #endregion 21 22 #endregion License Information 21 23 22 24 using System; … … 32 34 33 35 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Problems { 36 34 37 [Item("Single-objective Problem Definition Script", "Script that defines the parameter vector and evaluates the solution for a programmable problem.")] 35 38 [StorableClass] … … 39 42 [Storable] 40 43 private VariableStore variableStore; 44 41 45 public VariableStore VariableStore => variableStore; 42 46 … … 46 50 [StorableConstructor] 47 51 protected LinearProgrammingProblemDefinitionScript(bool deserializing) : base(deserializing) { } 52 48 53 protected LinearProgrammingProblemDefinitionScript(LinearProgrammingProblemDefinitionScript original, Cloner cloner) 49 54 : base(original, cloner) { … … 59 64 private readonly object compileLock = new object(); 60 65 private volatile ILinearProgrammingProblemDefinition compiledProblemDefinition; 66 61 67 protected ILinearProgrammingProblemDefinition CompiledProblemDefinition { 62 68 get { … … 65 71 lock (compileLock) { 66 72 if (compiledProblemDefinition == null) { 67 if (codeChanged) throw new ProblemDefinitionScriptException("The code has been changed, but was not recompiled."); 73 if (codeChanged) 74 throw new ProblemDefinitionScriptException("The code has been changed, but was not recompiled."); 68 75 Compile(false); 69 76 } … … 73 80 } 74 81 } 82 75 83 public dynamic Instance => compiledProblemDefinition; 76 84 77 public override Assembly Compile() { 78 return Compile(true); 79 } 85 public override Assembly Compile() => Compile(true); 80 86 81 87 private Assembly Compile(bool fireChanged) { … … 83 89 var types = assembly.GetTypes(); 84 90 if (!types.Any(x => typeof(CompiledProblemDefinition).IsAssignableFrom(x))) 85 throw new ProblemDefinitionScriptException("The compiled code doesn't contain a problem definition." + Environment.NewLine + "The problem definition must be a subclass of CompiledProblemDefinition."); 91 throw new ProblemDefinitionScriptException("The compiled code doesn't contain a problem definition." + 92 Environment.NewLine + 93 "The problem definition must be a subclass of CompiledProblemDefinition."); 86 94 if (types.Count(x => typeof(CompiledProblemDefinition).IsAssignableFrom(x)) > 1) 87 throw new ProblemDefinitionScriptException("The compiled code contains multiple problem definitions." + Environment.NewLine + "Only one subclass of CompiledProblemDefinition is allowed."); 95 throw new ProblemDefinitionScriptException("The compiled code contains multiple problem definitions." + 96 Environment.NewLine + 97 "Only one subclass of CompiledProblemDefinition is allowed."); 88 98 89 99 CompiledProblemDefinition inst; 90 100 try { 91 inst = (CompiledProblemDefinition)Activator.CreateInstance(types.Single(x => typeof(CompiledProblemDefinition).IsAssignableFrom(x))); 101 inst = (CompiledProblemDefinition)Activator.CreateInstance(types.Single(x => 102 typeof(CompiledProblemDefinition).IsAssignableFrom(x))); 92 103 } catch (Exception e) { 93 104 compiledProblemDefinition = null; 94 throw new ProblemDefinitionScriptException("Instantiating the problem definition failed." + Environment.NewLine + "Check your default constructor.", e); 105 throw new ProblemDefinitionScriptException( 106 "Instantiating the problem definition failed." + Environment.NewLine + "Check your default constructor.", e); 95 107 } 96 108 … … 100 112 } catch (Exception e) { 101 113 compiledProblemDefinition = null; 102 throw new ProblemDefinitionScriptException("Initializing the problem definition failed." + Environment.NewLine + "Check your Initialize() method.", e); 114 throw new ProblemDefinitionScriptException( 115 "Initializing the problem definition failed." + Environment.NewLine + "Check your Initialize() method.", e); 103 116 } 104 117 … … 108 121 } catch (Exception e) { 109 122 compiledProblemDefinition = null; 110 throw new ProblemDefinitionScriptException("Using the problem definition in the problem failed." + Environment.NewLine + "Examine this error message carefully (often there is an issue with the defined encoding).", e); 123 throw new ProblemDefinitionScriptException( 124 "Using the problem definition in the problem failed." + Environment.NewLine + 125 "Examine this error message carefully (often there is an issue with the defined encoding).", e); 111 126 } 112 127 … … 122 137 123 138 public event EventHandler ProblemDefinitionChanged; 124 private void OnProblemDefinitionChanged() { 125 var handler = ProblemDefinitionChanged; 126 if (handler != null) handler(this, EventArgs.Empty); 127 } 139 140 private void OnProblemDefinitionChanged() => ProblemDefinitionChanged?.Invoke(this, EventArgs.Empty); 128 141 129 142 public string Filename { get; set; } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Problems/LinearProgrammingProblemDefintion.cs
r16172 r16233 3 3 4 4 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Problems { 5 5 6 public class LinearProgrammingProblemDefintion : CompiledProblemDefinition { 6 7 7 public override void Initialize() { 8 8 public void BuildModel(Solver solver) { 9 9 } 10 10 11 public void BuildModel(Solver solver) { 12 11 public override void Initialize() { 13 12 } 14 13 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Problems/ProblemDefinitionScriptException.cs
r16172 r16233 1 1 #region License Information 2 2 3 /* HeuristicLab 3 4 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) … … 18 19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 20 */ 20 #endregion 21 22 #endregion License Information 21 23 22 24 using System; … … 24 26 25 27 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Problems { 28 26 29 [Serializable] 27 30 public class ProblemDefinitionScriptException : Exception { 28 public ProblemDefinitionScriptException() { } 29 public ProblemDefinitionScriptException(string message) : base(message) { } 30 public ProblemDefinitionScriptException(string message, Exception inner) : base(message, inner) { } 31 32 public ProblemDefinitionScriptException() { 33 } 34 35 public ProblemDefinitionScriptException(string message) : base(message) { 36 } 37 38 public ProblemDefinitionScriptException(string message, Exception inner) : base(message, inner) { 39 } 31 40 32 41 protected ProblemDefinitionScriptException(SerializationInfo info, StreamingContext context) -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Templates/CompiledLinearProgrammingProblemDefinition.cs
r16172 r16233 6 6 7 7 namespace HeuristicLab.MathematicalOptimization.LinearProgramming { 8 8 9 public class CompiledLinearProgrammingProblemDefinition : CompiledProblemDefinition, ILinearProgrammingProblemDefinition { 9 10 10 private Variable x; 11 11 private Variable y; … … 18 18 public void BuildModel(Solver solver) { 19 19 // Use vars.yourVariable to access variables in the variable store i.e. yourVariable 20 // Example model taken from https://developers.google.com/optimization/mip/integer_opt 20 // Example model taken from https://developers.google.com/optimization/mip/integer_opt 21 21 // Define the decision variables 22 22 x = solver.MakeIntVar(0, 3.5, "x"); -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Templates/ScriptTemplates.Designer.cs
r16172 r16233 9 9 //------------------------------------------------------------------------------ 10 10 11 using System.CodeDom.Compiler;12 using System.ComponentModel;13 using System.Diagnostics;14 using System.Diagnostics.CodeAnalysis;15 using System.Globalization;16 using System.Resources;17 using System.Runtime.CompilerServices;18 19 11 namespace HeuristicLab.MathematicalOptimization.LinearProgramming { 20 12 /// <summary> … … 25 17 // To add or remove a member, edit your .ResX file then rerun ResGen 26 18 // with the /str option, or rebuild your VS project. 27 [ GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]28 [ DebuggerNonUserCode()]29 [ CompilerGenerated()]19 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 20 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 21 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 30 22 internal class ScriptTemplates { 31 23 32 private static ResourceManager resourceMan;24 private static global::System.Resources.ResourceManager resourceMan; 33 25 34 private static CultureInfo resourceCulture;26 private static global::System.Globalization.CultureInfo resourceCulture; 35 27 36 [ SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]28 [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 37 29 internal ScriptTemplates() { 38 30 } … … 41 33 /// Returns the cached ResourceManager instance used by this class. 42 34 /// </summary> 43 [ EditorBrowsable(EditorBrowsableState.Advanced)]44 internal static ResourceManager ResourceManager {35 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 36 internal static global::System.Resources.ResourceManager ResourceManager { 45 37 get { 46 if ( ReferenceEquals(resourceMan, null)) {47 ResourceManager temp = newResourceManager("HeuristicLab.MathematicalOptimization.LinearProgramming.Templates.ScriptTemplates" +38 if (object.ReferenceEquals(resourceMan, null)) { 39 global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeuristicLab.MathematicalOptimization.LinearProgramming.Templates.ScriptTemplates" + 48 40 "", typeof(ScriptTemplates).Assembly); 49 41 resourceMan = temp; … … 57 49 /// resource lookups using this strongly typed resource class. 58 50 /// </summary> 59 [ EditorBrowsable(EditorBrowsableState.Advanced)]60 internal static CultureInfo Culture {51 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 52 internal static global::System.Globalization.CultureInfo Culture { 61 53 get { 62 54 return resourceCulture; … … 68 60 69 61 /// <summary> 70 /// Looks up a localized string similar to using System; 71 ///using System.Linq; 72 ///using System.Collections.Generic; 73 ///using HeuristicLab.Common; 74 ///using HeuristicLab.Core; 62 /// Looks up a localized string similar to using Google.OrTools.LinearSolver; 75 63 ///using HeuristicLab.Data; 76 ///using HeuristicLab.Encodings.BinaryVectorEncoding; 77 ///using HeuristicLab.Encodings.IntegerVectorEncoding; 78 ///using HeuristicLab.Encodings.RealVectorEncoding; 79 ///using HeuristicLab.Encodings.PermutationEncoding; 80 ///using HeuristicLab.Encodings.LinearLinkageEncoding; 81 ///using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 64 ///using HeuristicLab.MathematicalOptimization.LinearProgramming.Problems; 82 65 ///using HeuristicLab.Optimization; 83 ///using H [rest of string was truncated]";. 66 ///using HeuristicLab.Problems.Programmable; 67 /// 68 ///namespace HeuristicLab.MathematicalOptimization.LinearProgramming { 69 /// public class CompiledLinearProgrammingProblemDefinition : CompiledProblemDefinition, ILinearProgrammingProblemDefinition { 70 /// 71 /// private Variable x; 72 /// private Variable y; 73 /// 74 /// public override void Initialize() { 75 /// // [rest of string was truncated]";. 84 76 /// </summary> 85 77 internal static string CompiledLinearProgrammingProblemDefinition { -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Templates/ScriptTemplates.resx
r16172 r16233 60 60 : and then encoded with base64 encoding. 61 61 --> 62 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/ XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">63 <xsd:import namespace="http://www.w3.org/ XML/1998/namespace" />62 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/QualityUpdateIntervalMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> 63 <xsd:import namespace="http://www.w3.org/QualityUpdateIntervalML/1998/namespace" /> 64 64 <xsd:element name="root" msdata:IsDataSet="true"> 65 65 <xsd:complexType> -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Optimization.Views/3.3/BasicAlgorithmView.cs
r15583 r16233 37 37 base.SetEnabledStateOfControls(); 38 38 pauseButton.Enabled &= Content != null && Content.SupportsPause; 39 stopButton.Enabled &= Content != null && Content.SupportsStop; 39 40 } 40 41 … … 42 43 base.SetEnabledStateOfExecutableButtons(); 43 44 pauseButton.Enabled &= Content != null && Content.SupportsPause; 45 stopButton.Enabled &= Content != null && Content.SupportsStop; 44 46 } 45 47 } -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs
r15583 r16233 36 36 37 37 public abstract bool SupportsPause { get; } 38 public virtual bool SupportsStop { 39 get { return true; } 40 } 38 41 39 42 [Storable]
Note: See TracChangeset
for help on using the changeset viewer.