Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15574


Ignore:
Timestamp:
01/04/18 00:36:40 (6 years ago)
Author:
abeham
Message:

#1614: Added CPLEX algorithms

Location:
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3
Files:
6 added
11 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/CPLEX/CplexContext.cs

    r15562 r15574  
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2525
    26 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms {
    27   [Item("Single Solution Context", "A context for single solution algorithms.")]
    28   public abstract class SingleSolutionContext<TSolutionScope> : StochasticContext
    29     where TSolutionScope: class, IScope {
     26namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms.CPLEX {
     27  [Item("CPLEX Context", "A context for CPLEX solvers.")]
     28  public class CplexContext : SingleSolutionContext<ISingleObjectiveSolutionScope<GQAPSolution>> {
    3029   
    31     [Storable]
    32     private TSolutionScope incumbent;
    33     public TSolutionScope Incumbent {
    34       get { return incumbent; }
     30    [StorableConstructor]
     31    protected CplexContext(bool deserializing) : base(deserializing) { }
     32    protected CplexContext(CplexContext original, Cloner cloner)
     33      : base(original, cloner) {
    3534    }
    36 
    37     public void ReplaceIncumbent(TSolutionScope solScope) {
    38       if (incumbent != null) Scope.SubScopes.Remove(incumbent);
    39       this.incumbent = solScope;
    40       if (incumbent != null) Scope.SubScopes.Add(incumbent);
     35    public CplexContext() : base() { }
     36    public CplexContext(string name) : base(name) { }
     37    public CplexContext(string name, ParameterCollection parameters) : base(name, parameters) { }
     38    public CplexContext(string name, string description) : base(name, description) { }
     39    public CplexContext(string name, string description, ParameterCollection parameters) : base(name, description, parameters) { }
     40   
     41    public override IDeepCloneable Clone(Cloner cloner) {
     42      return new CplexContext(this, cloner);
    4143    }
    42 
    43 
    44     [StorableConstructor]
    45     protected SingleSolutionContext(bool deserializing) : base(deserializing) { }
    46     protected SingleSolutionContext(SingleSolutionContext<TSolutionScope> original, Cloner cloner)
    47       : base(original, cloner) {
    48       incumbent = cloner.Clone(original.incumbent);
    49     }
    50     protected SingleSolutionContext() : base() { }
    51     protected SingleSolutionContext(string name) : base(name) { }
    52     protected SingleSolutionContext(string name, ParameterCollection parameters) : base(name, parameters) { }
    53     protected SingleSolutionContext(string name, string description) : base(name, description) { }
    54     protected SingleSolutionContext(string name, string description, ParameterCollection parameters) : base(name, description, parameters) { }
    5544  }
    5645}
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/Evolutionary/EvolutionStrategy.cs

    r15572 r15574  
    145145      Results.Add(new Result("BestSolution", Context.BestSolution));
    146146
    147       Context.RunOperator(Analyzer, Context.Scope, cancellationToken);
     147      Context.RunOperator(Analyzer, cancellationToken);
    148148    }
    149149
     
    209209
    210210        try {
    211           Context.RunOperator(Analyzer, Context.Scope, cancellationToken);
     211          Context.RunOperator(Analyzer, cancellationToken);
    212212        } catch (OperationCanceledException) { }
    213213
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/Evolutionary/OSGA.cs

    r15572 r15574  
    118118      Results.Add(new Result("BestSolution", Context.BestSolution));
    119119
    120       Context.RunOperator(Analyzer, Context.Scope, cancellationToken);
     120      Context.RunOperator(Analyzer, cancellationToken);
    121121    }
    122122
     
    195195
    196196        try {
    197           Context.RunOperator(Analyzer, Context.Scope, cancellationToken);
     197          Context.RunOperator(Analyzer, cancellationToken);
    198198        } catch (OperationCanceledException) { }
    199199
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/GRASP/GRASP.cs

    r15572 r15574  
    162162      Results.Add(new Result("BestSolution", typeof(GQAPSolution)));
    163163
    164       Context.RunOperator(Analyzer, Context.Scope, cancellationToken);
     164      Context.RunOperator(Analyzer, cancellationToken);
    165165    }
    166166
     
    246246
    247247        try {
    248           Context.RunOperator(Analyzer, Context.Scope, cancellationToken);
     248          Context.RunOperator(Analyzer, cancellationToken);
    249249        } catch (OperationCanceledException) { }
    250250
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms-3.3.csproj

    r15572 r15574  
    9393      <Private>False</Private>
    9494    </Reference>
     95    <Reference Include="localsolvernet, Version=7.5.0.0, Culture=neutral, processorArchitecture=AMD64">
     96      <SpecificVersion>False</SpecificVersion>
     97      <HintPath>..\..\..\..\trunk\sources\bin\localsolvernet.dll</HintPath>
     98      <Private>False</Private>
     99    </Reference>
     100    <Reference Include="oplall, Version=12.7.0.0, Culture=neutral, PublicKeyToken=7906592bc7cc7340, processorArchitecture=MSIL">
     101      <SpecificVersion>False</SpecificVersion>
     102      <HintPath>..\..\..\..\trunk\sources\bin\oplall.dll</HintPath>
     103      <Private>False</Private>
     104    </Reference>
    95105    <Reference Include="System" />
    96106    <Reference Include="System.Core" />
     
    99109  </ItemGroup>
    100110  <ItemGroup>
     111    <Compile Include="CPLEX\CplexSolver.cs" />
     112    <Compile Include="CPLEX\GQAP-FY.cs" />
     113    <Compile Include="CPLEX\GQAP-KB.cs" />
     114    <Compile Include="CPLEX\GQAPDataSource.cs" />
     115    <Compile Include="CPLEX\CplexContext.cs" />
    101116    <Compile Include="Evolutionary\ESContext.cs" />
    102117    <Compile Include="Evolutionary\ESGQAPSolution.cs" />
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/Infrastructure/Algorithms/ContextAlgorithm.cs

    r15572 r15574  
    4848    [Storable]
    4949    private TContext context;
    50     protected TContext Context {
     50    public TContext Context {
    5151      get { return context; }
    5252    }
     
    132132      context.Iterations = 0;
    133133      context.EvaluatedSolutions = 0;
     134      context.BestQuality = double.NaN;
    134135    }
    135136
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/Infrastructure/Contexts/BasicContext.cs

    r15572 r15574  
    114114    }
    115115
    116     public void RunOperator(IOperator op, IScope scope, CancellationToken cancellationToken) {
     116    public void RunOperator(IOperator op, CancellationToken cancellationToken) {
    117117      var stack = new Stack<IOperation>();
    118118      stack.Push(((IExecutionContext)this).CreateChildOperation(op, scope));
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/LAHC/LAHC.cs

    r15572 r15574  
    101101      Results.Add(new Result("BestSolution", Context.BestSolution));
    102102
    103       Context.RunOperator(Analyzer, Context.Scope, token);
     103      try {
     104        Context.RunOperator(Analyzer, token);
     105      } catch (OperationCanceledException) { }
    104106    }
    105107
     
    157159
    158160        try {
    159           Context.RunOperator(Analyzer, Context.Scope, cancellationToken);
     161          Context.RunOperator(Analyzer, cancellationToken);
    160162        } catch (OperationCanceledException) { }
    161163
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/LAHC/pLAHC.cs

    r15572 r15574  
    112112      Results.Add(new Result("EvaluatedSolutions", new IntValue(Context.EvaluatedSolutions)));
    113113      Results.Add(new Result("CurrentMemorySize", new IntValue(0)));
     114
     115      try {
     116        Context.RunOperator(Analyzer, token);
     117      } catch (OperationCanceledException) { }
    114118    }
    115119
     
    189193
    190194          try {
    191             Context.RunOperator(Analyzer, Context.Scope, cancellationToken);
     195            Context.RunOperator(Analyzer, cancellationToken);
    192196          } catch (OperationCanceledException) { }
    193197
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/LocalSearch/IteratedLS.cs

    r15572 r15574  
    101101      Results.Add(new Result("BestSolution", Context.BestSolution));
    102102
    103       Context.RunOperator(Analyzer, Context.Scope, token);
     103      try {
     104        Context.RunOperator(Analyzer, token);
     105      } catch (OperationCanceledException) { }
    104106    }
    105107
     
    141143
    142144        try {
    143           Context.RunOperator(Analyzer, Context.Scope, cancellationToken);
     145          Context.RunOperator(Analyzer, cancellationToken);
    144146        } catch (OperationCanceledException) { }
    145147
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/LocalSearch/MultistartLS.cs

    r15572 r15574  
    108108
    109109        try {
    110           Context.RunOperator(Analyzer, Context.Scope, cancellationToken);
     110          Context.RunOperator(Analyzer, cancellationToken);
    111111        } catch (OperationCanceledException) { }
    112112
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/Plugin.cs

    r15553 r15574  
    4040  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
    4141  [PluginDependency("HeuristicLab.Random", "3.3")]
     42  [PluginDependency("CPLEX Transport", "12.7.0")]
     43  [PluginDependency("LocalSolver 7.5 Transport", "7.5")]
    4244  public class Plugin : PluginBase {
    4345  }
Note: See TracChangeset for help on using the changeset viewer.