Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/21/10 01:13:49 (13 years ago)
Author:
cneumuel
Message:

#1215

  • added possibility to create all parameter combinations from a ParameterConfigurationTree and generate an experiment from them
Location:
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/DoubleValueRange.cs

    r5112 r5144  
    3737      if (value.Value < this.LowerBound.Value) value.Value = this.LowerBound.Value;
    3838    }
     39
     40    public override IEnumerable<DoubleValue> GetCombinations() {
     41      var solutions = new List<DoubleValue>();
     42      double value = ((int)Math.Round(LowerBound.Value / StepSize.Value, 0)) * StepSize.Value;
     43      if (value < LowerBound.Value) value += StepSize.Value;
     44
     45      while (value <= UpperBound.Value) {
     46        //yield return new DoubleValue(value);
     47        solutions.Add(new DoubleValue(value));
     48        value += StepSize.Value;
     49      }
     50      return solutions;
     51    }
    3952  }
    4053}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/IntValueRange.cs

    r5112 r5144  
    3737      if (value.Value < this.LowerBound.Value) value.Value = this.LowerBound.Value;
    3838    }
     39
     40    public override IEnumerable<IntValue> GetCombinations() {
     41      var solutions = new List<IntValue>();
     42      int value = (this.LowerBound.Value / StepSize.Value) * StepSize.Value;
     43      if (value < this.LowerBound.Value) value += StepSize.Value;
     44
     45      while (value <= this.UpperBound.Value) {
     46        //yield return new IntValue(value);
     47        solutions.Add(new IntValue(value));
     48        value += this.StepSize.Value;
     49      }
     50      return solutions;
     51    }
    3952  }
    4053}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/PercentValueRange.cs

    r5112 r5144  
    3232      return new DoubleValueRange(LowerBound, UpperBound, StepSize);
    3333    }
     34
     35    public override IEnumerable<PercentValue> GetCombinations() {
     36      var solutions = new List<PercentValue>();
     37      double value = ((int)Math.Round(LowerBound.Value / StepSize.Value, 0)) * StepSize.Value;
     38      if (value < LowerBound.Value) value += StepSize.Value;
     39
     40      while (value <= UpperBound.Value) {
     41        //yield return new PercentValue(value);
     42        solutions.Add(new PercentValue(value));
     43        value += StepSize.Value;
     44      }
     45      return solutions;
     46    }
    3447  }
    3548}
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/RangeConstraints/Range.cs

    r5112 r5144  
    11using System;
     2using System.Collections.Generic;
     3using System.Linq;
    24using HeuristicLab.Common;
    35using HeuristicLab.Core;
     
    206208
    207209    protected abstract T GetRandomSample(IRandom random);
    208 
    209210    IItem IRange.GetRandomValue(IRandom random) {
    210211      return GetRandomValue(random);
    211212    }
     213
     214    public abstract IEnumerable<T> GetCombinations();
     215    IEnumerable<IItem> IRange.GetCombinations() {
     216      return GetCombinations().Cast<IItem>().ToArray();
     217    }
    212218  }
    213219}
Note: See TracChangeset for help on using the changeset viewer.