Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/20 14:44:19 (4 years ago)
Author:
abeham
Message:

#2521: working on refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/robocode/Problem.cs

    r17745 r17778  
    3434  [Item("Robocode Problem", "Evolution of a robocode program in java using genetic programming.")]
    3535  public class Problem : SymbolicExpressionTreeProblem {
    36     #region Parameter Names
    37     private const string RobocodePathParamaterName = "RobocodePath";
    38     private const string NrOfRoundsParameterName = "NrOfRounds";
    39     private const string EnemiesParameterName = "Enemies";
    40     #endregion
    41 
     36   
    4237    #region Parameters
    43     public IFixedValueParameter<DirectoryValue> RobocodePathParameter {
    44       get { return (IFixedValueParameter<DirectoryValue>)Parameters[RobocodePathParamaterName]; }
    45     }
    46     public IFixedValueParameter<IntValue> NrOfRoundsParameter {
    47       get { return (IFixedValueParameter<IntValue>)Parameters[NrOfRoundsParameterName]; }
    48     }
    49     public IValueParameter<EnemyCollection> EnemiesParameter {
    50       get { return (IValueParameter<EnemyCollection>)Parameters[EnemiesParameterName]; }
    51     }
     38    [Storable] public IFixedValueParameter<DirectoryValue> RobocodePathParameter { get; private set; }
     39    [Storable] public IFixedValueParameter<IntValue> NrOfRoundsParameter { get; private set; }
     40    [Storable] public IValueParameter<EnemyCollection> EnemiesParameter { get; private set; }
    5241
    5342    public string RobocodePath {
     
    7160    protected Problem(Problem original, Cloner cloner)
    7261      : base(original, cloner) {
     62      RobocodePathParameter = cloner.Clone(original.RobocodePathParameter);
     63      NrOfRoundsParameter = cloner.Clone(original.NrOfRoundsParameter);
     64      EnemiesParameter = cloner.Clone(original.EnemiesParameter);
     65
    7366      RegisterEventHandlers();
    7467    }
     
    8275
    8376
    84       Parameters.Add(new FixedValueParameter<DirectoryValue>(RobocodePathParamaterName, "Path of the Robocode installation.", robocodeDir));
    85       Parameters.Add(new FixedValueParameter<IntValue>(NrOfRoundsParameterName, "Number of rounds a robot has to fight against each opponent.", new IntValue(3)));
    86       Parameters.Add(new ValueParameter<EnemyCollection>(EnemiesParameterName, "The enemies that should be battled.", robotList));
     77      Parameters.Add(RobocodePathParameter = new FixedValueParameter<DirectoryValue>("RobocodePath", "Path of the Robocode installation.", robocodeDir));
     78      Parameters.Add(NrOfRoundsParameter = new FixedValueParameter<IntValue>("NrOfRounds", "Number of rounds a robot has to fight against each opponent.", new IntValue(3)));
     79      Parameters.Add(EnemiesParameter = new ValueParameter<EnemyCollection>("Enemies", "The enemies that should be battled.", robotList));
    8780
    8881      Encoding.FunctionArguments = 0;
Note: See TracChangeset for help on using the changeset viewer.