Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/17/18 17:51:26 (6 years ago)
Author:
ddorfmei
Message:

#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
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  
    113113  </ItemGroup>
    114114  <ItemGroup>
    115     <Content Include="GLPK-4.65-license.txt">
     115    <Content Include="glpk-license.txt">
    116116      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    117117    </Content>
     
    128128      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    129129    </Content>
     130    <Content Include="Google.OrTools.runtime.win-x64.dll">
     131      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     132    </Content>
    130133    <Content Include="Google.OrTools_version.txt">
    131134      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    132135    </Content>
    133136    <Content Include="Google.Protobuf.dll">
    134       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    135     </Content>
    136     <Content Include="runtime.win-x64.Google.OrTools.dll">
    137137      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    138138    </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  
    2828  [PluginFile("Google.OrTools.dll", PluginFileType.Assembly)]
    2929  [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)]
    3131  [PluginFile("Google.OrTools_version.txt", PluginFileType.Data)]
    3232  [PluginFile("glpk_4_65.dll", PluginFileType.NativeDll)]
    33   [PluginFile("GLPK-4.65-license.txt", PluginFileType.License)]
     33  [PluginFile("glpk-license.txt", PluginFileType.License)]
    3434  public class HeuristicLabOrToolsPlugin : PluginBase {
    3535  }
  • 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  
    5454// [assembly: AssemblyVersion("1.0.*")]
    5555[assembly: AssemblyVersion("6.8.0.0")]
    56 [assembly: AssemblyFileVersion("6.8.0.16138")]
     56[assembly: AssemblyFileVersion("6.8.0.16172")]
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/HeuristicLab.MathematicalOptimization-3.3.csproj

    r16172 r16233  
    131131  </ItemGroup>
    132132  <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" />
    137142    <Compile Include="LinearProgramming\Algorithms\LinearProgrammingType.cs" />
    138     <Compile Include="LinearProgramming\Algorithms\ScipSolver.cs" />
     143    <Compile Include="LinearProgramming\Algorithms\Solvers\ScipSolver.cs" />
    139144    <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" />
    143151    <Compile Include="LinearProgramming\Problems\ILinearProgrammingProblemDefinition.cs" />
    144152    <Compile Include="LinearProgramming\Algorithms\LinearProgrammingAlgorithm.cs" />
     
    149157    <Compile Include="LinearProgramming\OptimizationProblemType.cs" />
    150158    <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" />
    152161    <Compile Include="LinearProgramming\Views\LinearProgrammingProblemDefinitionScriptView.cs">
    153162      <SubType>UserControl</SubType>
     
    179188  </ItemGroup>
    180189  <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>
    181194    <ProjectReference Include="..\..\HeuristicLab.Clients.OKB\3.3\HeuristicLab.Clients.OKB-3.3.csproj">
    182195      <Project>{73857A9C-9706-4B72-8D9C-210B5B6A5691}</Project>
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/LinearProgrammingAlgorithm.cs

    r16172 r16233  
    11using System;
    22using System.Threading;
     3using Google.OrTools.LinearSolver;
    34using HeuristicLab.Common;
    45using HeuristicLab.Core;
    56using HeuristicLab.Data;
     7using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers;
     8using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base;
    69using HeuristicLab.MathematicalOptimization.LinearProgramming.Problems;
    710using HeuristicLab.Optimization;
     
    1013
    1114namespace 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)]
    1418  [StorableClass]
    1519  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;
    1638
    1739    [Storable]
     
    1941
    2042    [Storable]
    21     private readonly IFixedValueParameter<DoubleValue> relativeGapToleranceParam;
    22 
    23     [Storable]
    2443    private readonly IFixedValueParameter<TimeSpanValue> timeLimitParam;
    2544
    2645    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()));
    3066
    3167      Problem = new LinearProgrammingProblem();
     
    4278    [StorableConstructor]
    4379    private LinearProgrammingAlgorithm(bool deserializing)
    44       : base(deserializing) { }
     80      : base(deserializing) {
     81    }
    4582
    4683    private LinearProgrammingAlgorithm(LinearProgrammingAlgorithm original, Cloner cloner)
     
    4986      relativeGapToleranceParam = cloner.Clone(original.relativeGapToleranceParam);
    5087      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);
    5193    }
    5294
    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;
    56113    }
    57114
     
    62119
    63120    public override Type ProblemType { get; } = typeof(LinearProgrammingProblem);
     121
    64122    public double RelativeGapTolerance {
    65123      get => relativeGapToleranceParam.Value.Value;
     
    69127    public override ResultCollection Results { get; } = new ResultCollection();
    70128
    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;
    72142
    73143    public TimeSpan TimeLimit {
     
    77147
    78148    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;
    84149
    85         solver.Solve();
     150    public override void Pause() {
     151      base.Pause();
     152      Solver.Interrupt();
     153    }
    86154
    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();
    96161      }
    97162    }
     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);
    98172  }
    99173}
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/LinearProgrammingType.cs

    r16172 r16233  
    11namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {
     2
    23  public enum LinearProgrammingType {
    34    LinearProgramming,
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/Base/ISolver.cs

    r16232 r16233  
    1 using HeuristicLab.Core;
     1using System.Threading;
     2using HeuristicLab.Core;
    23
    3 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {
     4namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base {
     5
    46  public interface ISolver : IParameterizedNamedItem {
     7    LinearProgrammingType LinearProgrammingType { get; set; }
    58    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);
    819  }
    920}
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/Base/Solver.cs

    r16232 r16233  
    1 using HeuristicLab.Common;
     1using System;
     2using System.Threading;
     3using HeuristicLab.Common;
    24using HeuristicLab.Core;
    35using HeuristicLab.Data;
     
    57using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    68
    7 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {
     9namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base {
    810
    9   public class Solver : ParameterizedNamedItem, ISolver {
     11  [StorableClass]
     12  public class Solver : ParameterizedNamedItem, ISolver, IDisposable {
    1013
    1114    [Storable]
    12     protected IFixedValueParameter<StringValue> libraryNameParam;
     15    protected IValueParameter<EnumValue<LinearProgrammingType>> programmingTypeParam;
    1316
    14 
    15     [Storable]
    16     protected IFixedValueParameter<EnumValue<LinearProgrammingType>> programmingTypeParam;
     17    protected LinearSolver solver;
    1718
    1819    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>()));
    2123    }
    2224
    2325    [StorableConstructor]
    2426    protected Solver(bool deserializing)
    25       : base(deserializing) { }
     27      : base(deserializing) {
     28    }
    2629
    2730    protected Solver(Solver original, Cloner cloner)
    2831      : base(original, cloner) {
    29       libraryNameParam = cloner.Clone(original.libraryNameParam);
    3032      programmingTypeParam = cloner.Clone(original.programmingTypeParam);
    3133    }
    32 
    33     public string LibraryName {
    34       get => libraryNameParam?.Value.Value;
    35       set => libraryNameParam.Value.Value = value;
    36     }
    37 
    38     public virtual OptimizationProblemType OptimizationProblemType { get; }
    3934
    4035    public LinearProgrammingType LinearProgrammingType {
     
    4338    }
    4439
     40    public virtual OptimizationProblemType OptimizationProblemType { get; }
     41    public virtual bool SupportsPause => false;
     42    public virtual bool SupportsStop => false;
     43
    4544    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    }
    4696  }
    4797}
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/BopSolver.cs

    r16232 r16233  
    11using HeuristicLab.Core;
     2using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base;
    23using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    34
    4 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {
     5namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers {
     6
    57  [Item("BOP", "BOP (https://developers.google.com/optimization/reference/bop/bop_solver/) can be used out of the box.")]
    68  [StorableClass]
    7   public class BopSolver : Solver {
     9  public class BopSolver : IncrementalSolver {
    810
    911    public BopSolver() {
     
    1214
    1315    public override OptimizationProblemType OptimizationProblemType => OptimizationProblemType.BOP_INTEGER_PROGRAMMING;
     16    public override bool SupportsPause => true;
     17    public override bool SupportsStop => true;
    1418  }
    1519}
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/CoinOrSolver.cs

    r16232 r16233  
    11using HeuristicLab.Core;
     2using HeuristicLab.Data;
     3using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base;
    24using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    35
    4 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {
     6namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers {
     7
    58  [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.")]
    69  [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    }
    828
    929    public override OptimizationProblemType OptimizationProblemType =>
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/CplexSolver.cs

    r16232 r16233  
    11using HeuristicLab.Core;
    22using HeuristicLab.Data;
     3using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base;
    34using HeuristicLab.Parameters;
    45using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    56
    6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {
     7namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers {
    78
    89  [Item("CPLEX", "CPLEX (https://www.ibm.com/analytics/cplex-optimizer) must be installed and licenced.")]
    910  [StorableClass]
    10   public class CplexSolver : Solver {
     11  public class CplexSolver : ExternalIncrementalSolver {
    1112
    1213    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" }));
    1416    }
    1517
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/GlopSolver.cs

    r16232 r16233  
    11using HeuristicLab.Core;
    22using HeuristicLab.Data;
    3 using HeuristicLab.Parameters;
     3using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base;
    44using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    55
    6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {
     6namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers {
     7
    78  [Item("Glop", "Glop (https://developers.google.com/optimization/lp/glop) can be used out of the box.")]
    89  [StorableClass]
    9   public class GlopSolver : Solver {
     10  public class GlopSolver : IncrementalSolver {
    1011
    1112    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();
    1514    }
    1615
    1716    public override OptimizationProblemType OptimizationProblemType => OptimizationProblemType.GLOP_LINEAR_PROGRAMMING;
     17    public override bool SupportsPause => true;
     18    public override bool SupportsStop => true;
    1819  }
    1920}
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/GlpkSolver.cs

    r16232 r16233  
    11using HeuristicLab.Core;
    22using HeuristicLab.Data;
     3using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base;
    34using HeuristicLab.Parameters;
    45using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    56
    6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {
     7namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers {
     8
    79  [Item("GLPK", "GLPK (https://www.gnu.org/software/glpk/) can be used out of the box.")]
    810  [StorableClass]
    9   public class GlpkSolver : Solver {
     11  public class GlpkSolver : ExternalIncrementalSolver {
    1012
    1113    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      };
    1331    }
    1432
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/GurobiSolver.cs

    r16232 r16233  
    1 using HeuristicLab.Core;
     1using HeuristicLab.Common;
     2using HeuristicLab.Core;
    23using HeuristicLab.Data;
     4using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base;
    35using HeuristicLab.Parameters;
    46using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    57
    6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {
     8namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers {
     9
    710  [Item("Gurobi", "Gurobi (http://www.gurobi.com/) must be installed and licenced.")]
    811  [StorableClass]
    9   public class GurobiSolver : Solver {
     12  public class GurobiSolver : ExternalIncrementalSolver {
    1013
    1114    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);
    1322    }
    1423
     
    1726        ? OptimizationProblemType.GUROBI_LINEAR_PROGRAMMING
    1827        : OptimizationProblemType.GUROBI_MIXED_INTEGER_PROGRAMMING;
     28
     29    public override bool SupportsPause => true;
     30    public override bool SupportsStop => true;
    1931  }
    2032}
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Algorithms/Solvers/ScipSolver.cs

    r16232 r16233  
    11using HeuristicLab.Core;
    22using HeuristicLab.Data;
     3using HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers.Base;
    34using HeuristicLab.Parameters;
    45using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    56
    6 namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms {
     7namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Algorithms.Solvers {
     8
    79  [Item("SCIP", "SCIP (http://scip.zib.de/) must be installed and licenced.")]
    810  [StorableClass]
    9   public class ScipSolver : Solver {
     11  public class ScipSolver : ExternalSolver {
    1012
    1113    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();
    1619    }
    1720
    1821    public override OptimizationProblemType OptimizationProblemType =>
    1922      OptimizationProblemType.SCIP_MIXED_INTEGER_PROGRAMMING;
     23
     24    public override bool SupportsPause => true;
     25    public override bool SupportsStop => true;
    2026  }
    2127}
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Problems/ILinearProgrammingProblemDefinition.cs

    r16172 r16233  
    11#region License Information
     2
    23/* HeuristicLab
    34 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     
    1819 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    1920 */
    20 #endregion
     21
     22#endregion License Information
    2123
    2224using Google.OrTools.LinearSolver;
     
    2426
    2527namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Problems {
     28
    2629  public interface ILinearProgrammingProblemDefinition {
     30
    2731    void BuildModel(Solver solver);
     32
    2833    void Analyze(Solver solver, ResultCollection results);
    2934  }
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Problems/LinearProgrammingProblem.cs

    r16172 r16233  
    11#region License Information
     2
    23/* HeuristicLab
    34 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     
    1819 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    1920 */
    20 #endregion
     21
     22#endregion License Information
    2123
    2224using System.Drawing;
     
    3032
    3133namespace 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)]
    3437  [StorableClass]
    3538  public class LinearProgrammingProblem : Problem, IProgrammableItem {
    3639
    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    }
    4445
    4546    private LinearProgrammingProblem(LinearProgrammingProblem original, Cloner cloner)
     
    4748      RegisterEvents();
    4849    }
    49     public override IDeepCloneable Clone(Cloner cloner) { return new LinearProgrammingProblem(this, cloner); }
    5050
    5151    [StorableConstructor]
    5252    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;
    5770    }
    5871
     
    6275    }
    6376
     77    private void OnProblemDefinitionChanged() {
     78      OnOperatorsChanged();
     79      OnReset();
     80    }
     81
     82    private void OnProblemScriptNameChanged() {
     83      Name = ProblemScript.Name;
     84    }
     85
    6486    private void RegisterEvents() {
    6587      ProblemScript.ProblemDefinitionChanged += (o, e) => OnProblemDefinitionChanged();
    6688      ProblemScript.NameChanged += (o, e) => OnProblemScriptNameChanged();
    6789    }
    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     //}
    10290  }
    10391}
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Problems/LinearProgrammingProblemDefinitionScript.cs

    r16172 r16233  
    11#region License Information
     2
    23/* HeuristicLab
    34 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     
    1819 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    1920 */
    20 #endregion
     21
     22#endregion License Information
    2123
    2224using System;
     
    3234
    3335namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Problems {
     36
    3437  [Item("Single-objective Problem Definition Script", "Script that defines the parameter vector and evaluates the solution for a programmable problem.")]
    3538  [StorableClass]
     
    3942    [Storable]
    4043    private VariableStore variableStore;
     44
    4145    public VariableStore VariableStore => variableStore;
    4246
     
    4650    [StorableConstructor]
    4751    protected LinearProgrammingProblemDefinitionScript(bool deserializing) : base(deserializing) { }
     52
    4853    protected LinearProgrammingProblemDefinitionScript(LinearProgrammingProblemDefinitionScript original, Cloner cloner)
    4954      : base(original, cloner) {
     
    5964    private readonly object compileLock = new object();
    6065    private volatile ILinearProgrammingProblemDefinition compiledProblemDefinition;
     66
    6167    protected ILinearProgrammingProblemDefinition CompiledProblemDefinition {
    6268      get {
     
    6571          lock (compileLock) {
    6672            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.");
    6875              Compile(false);
    6976            }
     
    7380      }
    7481    }
     82
    7583    public dynamic Instance => compiledProblemDefinition;
    7684
    77     public override Assembly Compile() {
    78       return Compile(true);
    79     }
     85    public override Assembly Compile() => Compile(true);
    8086
    8187    private Assembly Compile(bool fireChanged) {
     
    8389      var types = assembly.GetTypes();
    8490      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.");
    8694      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.");
    8898
    8999      CompiledProblemDefinition inst;
    90100      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)));
    92103      } catch (Exception e) {
    93104        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);
    95107      }
    96108
     
    100112      } catch (Exception e) {
    101113        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);
    103116      }
    104117
     
    108121      } catch (Exception e) {
    109122        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);
    111126      }
    112127
     
    122137
    123138    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);
    128141
    129142    public string Filename { get; set; }
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Problems/LinearProgrammingProblemDefintion.cs

    r16172 r16233  
    33
    44namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Problems {
     5
    56  public class LinearProgrammingProblemDefintion : CompiledProblemDefinition {
    67
    7     public override void Initialize() {
    8 
     8    public void BuildModel(Solver solver) {
    99    }
    1010
    11     public void BuildModel(Solver solver) {
    12 
     11    public override void Initialize() {
    1312    }
    1413  }
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Problems/ProblemDefinitionScriptException.cs

    r16172 r16233  
    11#region License Information
     2
    23/* HeuristicLab
    34 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     
    1819 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    1920 */
    20 #endregion
     21
     22#endregion License Information
    2123
    2224using System;
     
    2426
    2527namespace HeuristicLab.MathematicalOptimization.LinearProgramming.Problems {
     28
    2629  [Serializable]
    2730  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    }
    3140
    3241    protected ProblemDefinitionScriptException(SerializationInfo info, StreamingContext context)
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Templates/CompiledLinearProgrammingProblemDefinition.cs

    r16172 r16233  
    66
    77namespace HeuristicLab.MathematicalOptimization.LinearProgramming {
     8
    89  public class CompiledLinearProgrammingProblemDefinition : CompiledProblemDefinition, ILinearProgrammingProblemDefinition {
    9 
    1010    private Variable x;
    1111    private Variable y;
     
    1818    public void BuildModel(Solver solver) {
    1919      // 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
    2121      // Define the decision variables
    2222      x = solver.MakeIntVar(0, 3.5, "x");
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Templates/ScriptTemplates.Designer.cs

    r16172 r16233  
    99//------------------------------------------------------------------------------
    1010
    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 
    1911namespace HeuristicLab.MathematicalOptimization.LinearProgramming {
    2012  /// <summary>
     
    2517  // To add or remove a member, edit your .ResX file then rerun ResGen
    2618  // 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()]
    3022  internal class ScriptTemplates {
    3123
    32     private static ResourceManager resourceMan;
     24    private static global::System.Resources.ResourceManager resourceMan;
    3325
    34     private static CultureInfo resourceCulture;
     26    private static global::System.Globalization.CultureInfo resourceCulture;
    3527
    36     [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
     28    [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
    3729    internal ScriptTemplates() {
    3830    }
     
    4133    ///   Returns the cached ResourceManager instance used by this class.
    4234    /// </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 {
    4537      get {
    46         if (ReferenceEquals(resourceMan, null)) {
    47           ResourceManager temp = new ResourceManager("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" +
    4840                  "", typeof(ScriptTemplates).Assembly);
    4941          resourceMan = temp;
     
    5749    ///   resource lookups using this strongly typed resource class.
    5850    /// </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 {
    6153      get {
    6254        return resourceCulture;
     
    6860
    6961    /// <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;
    7563    ///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;
    8265    ///using HeuristicLab.Optimization;
    83     ///using H [rest of string was truncated]&quot;;.
     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]&quot;;.
    8476    /// </summary>
    8577    internal static string CompiledLinearProgrammingProblemDefinition {
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.MathematicalOptimization/3.3/LinearProgramming/Templates/ScriptTemplates.resx

    r16172 r16233  
    6060            : and then encoded with base64 encoding.
    6161    -->
    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" />
    6464    <xsd:element name="root" msdata:IsDataSet="true">
    6565      <xsd:complexType>
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.Optimization.Views/3.3/BasicAlgorithmView.cs

    r15583 r16233  
    3737      base.SetEnabledStateOfControls();
    3838      pauseButton.Enabled &= Content != null && Content.SupportsPause;
     39      stopButton.Enabled &= Content != null && Content.SupportsStop;
    3940    }
    4041
     
    4243      base.SetEnabledStateOfExecutableButtons();
    4344      pauseButton.Enabled &= Content != null && Content.SupportsPause;
     45      stopButton.Enabled &= Content != null && Content.SupportsStop;
    4446    }
    4547  }
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs

    r15583 r16233  
    3636
    3737    public abstract bool SupportsPause { get; }
     38    public virtual bool SupportsStop {
     39      get { return true; }
     40    }
    3841
    3942    [Storable]
Note: See TracChangeset for help on using the changeset viewer.