Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/08/10 02:21:50 (15 years ago)
Author:
swagner
Message:

Continued work on algorithm batch processing (#947).

Location:
trunk/sources/HeuristicLab.Optimization/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs

    r3283 r3286  
    126126      runs = new RunCollection();
    127127    }
    128     internal Algorithm(Algorithm algorithm, Cloner cloner)
    129       : base(algorithm.Name, algorithm.Description, (ParameterCollection)cloner.Clone(algorithm.Parameters)) {
    130       executionState = algorithm.executionState;
    131       executionTime = algorithm.executionTime;
    132       problem = (IProblem)cloner.Clone(algorithm.problem);
    133       runsCounter = algorithm.runsCounter;
    134       runs = (RunCollection)cloner.Clone(algorithm.runs);
    135       Initialize();
    136     }
    137128    [StorableConstructor]
    138129    protected Algorithm(bool deserializing) : base(deserializing) { }
     
    154145      return clone;
    155146    }
     147    protected virtual void Clone(IDeepCloneable clone, Cloner cloner) {
     148      Algorithm algorithm = clone as Algorithm;
     149      if (algorithm != null) {
     150        algorithm.name = name;
     151        algorithm.description = description;
     152        foreach (IParameter param in Parameters)
     153          algorithm.Parameters.Add((IParameter)cloner.Clone(param));
     154        algorithm.executionState = executionState;
     155        algorithm.executionTime = executionTime;
     156        algorithm.problem = (IProblem)cloner.Clone(problem);
     157        algorithm.runsCounter = runsCounter;
     158        algorithm.runs = (RunCollection)cloner.Clone(runs);
     159        algorithm.Initialize();
     160      }
     161    }
    156162
    157163    public virtual void Prepare() {
  • trunk/sources/HeuristicLab.Optimization/3.3/EngineAlgorithm.cs

    r3283 r3286  
    112112      Initialize();
    113113    }
    114     internal EngineAlgorithm(EngineAlgorithm algorithm, Cloner cloner)
    115       : base(algorithm, cloner) {
    116       globalScope = (IScope)cloner.Clone(algorithm.globalScope);
    117       operatorGraph = (OperatorGraph)cloner.Clone(algorithm.operatorGraph);
    118       engine = (IEngine)cloner.Clone(algorithm.engine);
    119       Initialize();
    120     }
    121114    [StorableConstructor]
    122115    protected EngineAlgorithm(bool deserializing) : base(deserializing) { }
     
    142135      return clone;
    143136    }
     137    protected override void Clone(IDeepCloneable clone, Cloner cloner) {
     138      base.Clone(clone, cloner);
     139      EngineAlgorithm algorithm = clone as EngineAlgorithm;
     140      if (algorithm != null) {
     141        algorithm.globalScope = (IScope)cloner.Clone(globalScope);
     142        algorithm.engine = (IEngine)cloner.Clone(engine);
     143        algorithm.operatorGraph = (OperatorGraph)cloner.Clone(operatorGraph);
     144        algorithm.Initialize();
     145      }
     146    }
    144147
    145148    public UserDefinedAlgorithm CreateUserDefinedAlgorithm() {
    146       return new UserDefinedAlgorithm(this, new Cloner());
     149      UserDefinedAlgorithm algorithm = new UserDefinedAlgorithm();
     150      Cloner cloner = new Cloner();
     151      cloner.RegisterClonedObject(this, algorithm);
     152      Clone(algorithm, cloner);
     153      return algorithm;
    147154    }
    148155
  • trunk/sources/HeuristicLab.Optimization/3.3/UserDefinedAlgorithm.cs

    r3280 r3286  
    5252    public UserDefinedAlgorithm(string name) : base(name) { }
    5353    public UserDefinedAlgorithm(string name, string description) : base(name, description) { }
    54     internal UserDefinedAlgorithm(EngineAlgorithm algorithm, Cloner cloner) : base(algorithm, cloner) { }
    5554    [StorableConstructor]
    5655    private UserDefinedAlgorithm(bool deserializing) : base(deserializing) { }
Note: See TracChangeset for help on using the changeset viewer.