Changeset 15574
- Timestamp:
- 01/04/18 00:36:40 (7 years ago)
- 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 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 25 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 { 26 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms.CPLEX { 27 [Item("CPLEX Context", "A context for CPLEX solvers.")] 28 public class CplexContext : SingleSolutionContext<ISingleObjectiveSolutionScope<GQAPSolution>> { 30 29 31 [Storable ]32 pr ivate TSolutionScope incumbent;33 p ublic 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) { 35 34 } 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); 41 43 } 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) { }55 44 } 56 45 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/Evolutionary/EvolutionStrategy.cs
r15572 r15574 145 145 Results.Add(new Result("BestSolution", Context.BestSolution)); 146 146 147 Context.RunOperator(Analyzer, Context.Scope,cancellationToken);147 Context.RunOperator(Analyzer, cancellationToken); 148 148 } 149 149 … … 209 209 210 210 try { 211 Context.RunOperator(Analyzer, Context.Scope,cancellationToken);211 Context.RunOperator(Analyzer, cancellationToken); 212 212 } catch (OperationCanceledException) { } 213 213 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/Evolutionary/OSGA.cs
r15572 r15574 118 118 Results.Add(new Result("BestSolution", Context.BestSolution)); 119 119 120 Context.RunOperator(Analyzer, Context.Scope,cancellationToken);120 Context.RunOperator(Analyzer, cancellationToken); 121 121 } 122 122 … … 195 195 196 196 try { 197 Context.RunOperator(Analyzer, Context.Scope,cancellationToken);197 Context.RunOperator(Analyzer, cancellationToken); 198 198 } catch (OperationCanceledException) { } 199 199 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/GRASP/GRASP.cs
r15572 r15574 162 162 Results.Add(new Result("BestSolution", typeof(GQAPSolution))); 163 163 164 Context.RunOperator(Analyzer, Context.Scope,cancellationToken);164 Context.RunOperator(Analyzer, cancellationToken); 165 165 } 166 166 … … 246 246 247 247 try { 248 Context.RunOperator(Analyzer, Context.Scope,cancellationToken);248 Context.RunOperator(Analyzer, cancellationToken); 249 249 } catch (OperationCanceledException) { } 250 250 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms-3.3.csproj
r15572 r15574 93 93 <Private>False</Private> 94 94 </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> 95 105 <Reference Include="System" /> 96 106 <Reference Include="System.Core" /> … … 99 109 </ItemGroup> 100 110 <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" /> 101 116 <Compile Include="Evolutionary\ESContext.cs" /> 102 117 <Compile Include="Evolutionary\ESGQAPSolution.cs" /> -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/Infrastructure/Algorithms/ContextAlgorithm.cs
r15572 r15574 48 48 [Storable] 49 49 private TContext context; 50 p rotectedTContext Context {50 public TContext Context { 51 51 get { return context; } 52 52 } … … 132 132 context.Iterations = 0; 133 133 context.EvaluatedSolutions = 0; 134 context.BestQuality = double.NaN; 134 135 } 135 136 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/Infrastructure/Contexts/BasicContext.cs
r15572 r15574 114 114 } 115 115 116 public void RunOperator(IOperator op, IScope scope,CancellationToken cancellationToken) {116 public void RunOperator(IOperator op, CancellationToken cancellationToken) { 117 117 var stack = new Stack<IOperation>(); 118 118 stack.Push(((IExecutionContext)this).CreateChildOperation(op, scope)); -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/LAHC/LAHC.cs
r15572 r15574 101 101 Results.Add(new Result("BestSolution", Context.BestSolution)); 102 102 103 Context.RunOperator(Analyzer, Context.Scope, token); 103 try { 104 Context.RunOperator(Analyzer, token); 105 } catch (OperationCanceledException) { } 104 106 } 105 107 … … 157 159 158 160 try { 159 Context.RunOperator(Analyzer, Context.Scope,cancellationToken);161 Context.RunOperator(Analyzer, cancellationToken); 160 162 } catch (OperationCanceledException) { } 161 163 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/LAHC/pLAHC.cs
r15572 r15574 112 112 Results.Add(new Result("EvaluatedSolutions", new IntValue(Context.EvaluatedSolutions))); 113 113 Results.Add(new Result("CurrentMemorySize", new IntValue(0))); 114 115 try { 116 Context.RunOperator(Analyzer, token); 117 } catch (OperationCanceledException) { } 114 118 } 115 119 … … 189 193 190 194 try { 191 Context.RunOperator(Analyzer, Context.Scope,cancellationToken);195 Context.RunOperator(Analyzer, cancellationToken); 192 196 } catch (OperationCanceledException) { } 193 197 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/LocalSearch/IteratedLS.cs
r15572 r15574 101 101 Results.Add(new Result("BestSolution", Context.BestSolution)); 102 102 103 Context.RunOperator(Analyzer, Context.Scope, token); 103 try { 104 Context.RunOperator(Analyzer, token); 105 } catch (OperationCanceledException) { } 104 106 } 105 107 … … 141 143 142 144 try { 143 Context.RunOperator(Analyzer, Context.Scope,cancellationToken);145 Context.RunOperator(Analyzer, cancellationToken); 144 146 } catch (OperationCanceledException) { } 145 147 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/LocalSearch/MultistartLS.cs
r15572 r15574 108 108 109 109 try { 110 Context.RunOperator(Analyzer, Context.Scope,cancellationToken);110 Context.RunOperator(Analyzer, cancellationToken); 111 111 } catch (OperationCanceledException) { } 112 112 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms/3.3/Plugin.cs
r15553 r15574 40 40 [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] 41 41 [PluginDependency("HeuristicLab.Random", "3.3")] 42 [PluginDependency("CPLEX Transport", "12.7.0")] 43 [PluginDependency("LocalSolver 7.5 Transport", "7.5")] 42 44 public class Plugin : PluginBase { 43 45 }
Note: See TracChangeset
for help on using the changeset viewer.