Changeset 11593


Ignore:
Timestamp:
11/27/14 10:41:15 (7 years ago)
Author:
mkommend
Message:

#2174: Fixed addition of parameters in the encodings and set default values for encoding operators in MultiEncodingOperator.

Location:
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Encodings/BinaryEncoding.cs

    r11588 r11593  
    7272    public BinaryEncoding(string name, int length)
    7373      : base(name) {
    74       LengthParameter = new FixedValueParameter<IntValue>(Name + "Length", new IntValue(length));
     74      lengthParameter = new FixedValueParameter<IntValue>(Name + ".Length", new IntValue(length));
     75      Parameters.Add(lengthParameter);
     76
    7577      SolutionCreator = new RandomBinaryVectorCreator();
    7678      RegisterParameterEvents();
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Encodings/IntegerEncoding.cs

    r11588 r11593  
    102102      if (step.HasValue) bounds[0, 2] = step.Value;
    103103
    104       LengthParameter = new FixedValueParameter<IntValue>(Name + "Length", new IntValue(length));
    105       BoundsParameter = new ValueParameter<IntMatrix>(Name + "Bounds", bounds);
     104      lengthParameter = new FixedValueParameter<IntValue>(Name + ".Length", new IntValue(length));
     105      boundsParameter = new ValueParameter<IntMatrix>(Name + ".Bounds", bounds);
     106      Parameters.Add(lengthParameter);
     107      Parameters.Add(boundsParameter);
    106108
    107109      SolutionCreator = new UniformRandomIntegerVectorCreator();
     
    123125      }
    124126
    125       LengthParameter = new FixedValueParameter<IntValue>(Name + "Length", new IntValue(length));
    126       BoundsParameter = new ValueParameter<IntMatrix>(Name + "Bounds", bounds);
     127      LengthParameter = new FixedValueParameter<IntValue>(Name + ".Length", new IntValue(length));
     128      BoundsParameter = new ValueParameter<IntMatrix>(Name + ".Bounds", bounds);
    127129
    128130      SolutionCreator = new UniformRandomIntegerVectorCreator();
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Encodings/PermutationEncoding.cs

    r11588 r11593  
    9595    public PermutationEncoding(string name, int length, PermutationTypes type)
    9696      : base(name) {
    97       LengthParameter = new FixedValueParameter<IntValue>(Name + "Length", new IntValue(length));
    98       PermutationTypeParameter = new FixedValueParameter<PermutationType>(Name + "Type", new PermutationType(type));
     97      lengthParameter = new FixedValueParameter<IntValue>(Name + ".Length", new IntValue(length));
     98      permutationTypeParameter = new FixedValueParameter<PermutationType>(Name + ".Type", new PermutationType(type));
     99      Parameters.Add(lengthParameter);
     100      Parameters.Add(permutationTypeParameter);
    99101
    100102      SolutionCreator = new RandomPermutationCreator();
     
    194196    private void ConfigureInversionMoveOperators(IEnumerable<IPermutationInversionMoveOperator> inversionMoveOperators) {
    195197      foreach (var inversionMoveOperator in inversionMoveOperators) {
    196         inversionMoveOperator.InversionMoveParameter.ActualName = Name + "_InversionMove";
     198        inversionMoveOperator.InversionMoveParameter.ActualName = Name + ".InversionMove";
    197199      }
    198200    }
    199201    private void ConfigureScrambleMoveOperators(IEnumerable<IPermutationScrambleMoveOperator> scrambleMoveOperators) {
    200202      foreach (var scrambleMoveOperator in scrambleMoveOperators) {
    201         scrambleMoveOperator.ScrambleMoveParameter.ActualName = Name + "_ScambleMove";
     203        scrambleMoveOperator.ScrambleMoveParameter.ActualName = Name + ".ScambleMove";
    202204      }
    203205    }
    204206    private void ConfigureSwap2MoveOperators(IEnumerable<IPermutationSwap2MoveOperator> swap2MoveOperators) {
    205207      foreach (var swap2MoveOperator in swap2MoveOperators) {
    206         swap2MoveOperator.Swap2MoveParameter.ActualName = Name + "_Swap2Move";
     208        swap2MoveOperator.Swap2MoveParameter.ActualName = Name + ".Swap2Move";
    207209      }
    208210    }
    209211    private void ConfigureTranslocationMoveOperators(IEnumerable<IPermutationTranslocationMoveOperator> translocationMoveOperators) {
    210212      foreach (var translocationMoveOperator in translocationMoveOperators) {
    211         translocationMoveOperator.TranslocationMoveParameter.ActualName = Name + "_TranslocationMove";
     213        translocationMoveOperator.TranslocationMoveParameter.ActualName = Name + ".TranslocationMove";
    212214      }
    213215    }
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Encodings/RealEncoding.cs

    r11588 r11593  
    100100      bounds[0, 1] = max;
    101101
    102       LengthParameter = new FixedValueParameter<IntValue>(Name + "Length", new IntValue(length));
    103       BoundsParameter = new ValueParameter<DoubleMatrix>(Name + "Bounds", bounds);
     102      lengthParameter = new FixedValueParameter<IntValue>(Name + ".Length", new IntValue(length));
     103      boundsParameter = new ValueParameter<DoubleMatrix>(Name + ".Bounds", bounds);
     104      Parameters.Add(lengthParameter);
     105      Parameters.Add(boundsParameter);
    104106
    105107      SolutionCreator = new UniformRandomRealVectorCreator();
     
    119121        bounds[i, 1] = max[i];
    120122      }
    121       LengthParameter = new FixedValueParameter<IntValue>(Name + "Length", new IntValue(length));
    122       BoundsParameter = new ValueParameter<DoubleMatrix>(Name + "Bounds", bounds);
     123      LengthParameter = new FixedValueParameter<IntValue>(Name + ".Length", new IntValue(length));
     124      BoundsParameter = new ValueParameter<DoubleMatrix>(Name + ".Bounds", bounds);
    123125
    124126      SolutionCreator = new UniformRandomRealVectorCreator();
     
    228230          var p = sm.StrategyParameterParameter as ILookupParameter;
    229231          if (p != null) {
    230             p.ActualName = Name + "Strategy";
     232            p.ActualName = Name + ".Strategy";
    231233          }
    232234        }
     
    244246          c.BoundsParameter.Value = (DoubleMatrix)bounds.Clone();
    245247          c.LengthParameter.ActualName = LengthParameter.Name;
    246           c.StrategyParameterParameter.ActualName = Name + "Strategy";
     248          c.StrategyParameterParameter.ActualName = Name + ".Strategy";
    247249        }
    248250        var m = s as IRealVectorStdDevStrategyParameterManipulator;
    249251        if (m != null) {
    250252          m.BoundsParameter.Value = (DoubleMatrix)bounds.Clone();
    251           m.StrategyParameterParameter.ActualName = Name + "Strategy";
     253          m.StrategyParameterParameter.ActualName = Name + ".Strategy";
    252254        }
    253255        var mm = s as StdDevStrategyVectorManipulator;
     
    258260        var x = s as IRealVectorStdDevStrategyParameterCrossover;
    259261        if (x != null) {
    260           x.ParentsParameter.ActualName = Name + "Strategy";
    261           x.StrategyParameterParameter.ActualName = Name + "Strategy";
     262          x.ParentsParameter.ActualName = Name + ".Strategy";
     263          x.StrategyParameterParameter.ActualName = Name + ".Strategy";
    262264        }
    263265      }
     
    304306    private void ConfigureAdditiveMoveOperator(IEnumerable<IAdditiveRealVectorMoveOperator> additiveMoveOperators) {
    305307      foreach (var additiveMoveOperator in additiveMoveOperators) {
    306         additiveMoveOperator.AdditiveMoveParameter.ActualName = Name + "_AdditiveMove";
     308        additiveMoveOperator.AdditiveMoveParameter.ActualName = Name + ".AdditiveMove";
    307309      }
    308310    }
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/MultiEncodingOperator.cs

    r11587 r11593  
    4545      if (Parameters.ContainsKey(encoding.Name)) throw new ArgumentException(string.Format("Encoding {0} was already added.", encoding.Name));
    4646      var param = new ConstrainedValueParameter<T>(encoding.Name, new ItemSet<T>(encoding.Operators.OfType<T>()));
    47 
     47      param.Value = param.ValidValues.First();
    4848      Parameters.Add(param);
    4949    }
Note: See TracChangeset for help on using the changeset viewer.