Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/05/12 11:11:56 (12 years ago)
Author:
jkarder
Message:

#1853:

  • extracted experiment generation from encoding
  • added creators
  • added crossovers
  • added manipulators
  • added support for parameters of type IFixedValueParameter
  • minor code improvements
Location:
branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3
Files:
40 added
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/HeuristicLab.Encodings.ParameterConfigurationEncoding-3.3.csproj

    r8524 r8574  
    5858      <Private>False</Private>
    5959    </Reference>
     60    <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     61    <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    6062    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
    6163      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
    6264      <Private>False</Private>
    6365    </Reference>
     66    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    6467    <Reference Include="HeuristicLab.Optimization-3.3">
    6568      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
     
    7881      <Private>False</Private>
    7982    </Reference>
     83    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    8084    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4">
    8185      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath>
     
    8589      <Private>False</Private>
    8690    </Reference>
     91    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     92    <Reference Include="Microsoft.CSharp" />
    8793    <Reference Include="System" />
    8894    <Reference Include="System.Core" />
     
    94100    <Compile Include="AlgorithmProblemItem.cs" />
    95101    <None Include="Plugin.cs.frame" />
    96     <Compile Include="ConstrainedItemList.cs" />
    97     <Compile Include="ConstrainedTypeValue.cs" />
     102    <Compile Include="Creators\RandomParameterConfigurationCreator.cs" />
     103    <Compile Include="Crossovers\ParameterConfigurationCrossover.cs" />
     104    <Compile Include="ExperimentFactory.cs" />
    98105    <Compile Include="Interfaces\ICheckedValueConfigurationCollection.cs" />
    99106    <Compile Include="Interfaces\IOptimizable.cs" />
    100107    <Compile Include="Interfaces\IParameterConfiguration.cs" />
     108    <Compile Include="Interfaces\IParameterConfigurationCreator.cs" />
     109    <Compile Include="Interfaces\IParameterConfigurationCrossover.cs" />
     110    <Compile Include="Interfaces\IParameterConfigurationEvaluator.cs" />
     111    <Compile Include="Interfaces\IParameterConfigurationManipulator.cs" />
     112    <Compile Include="Interfaces\IParameterConfigurationOperator.cs" />
    101113    <Compile Include="Interfaces\IRange.cs" />
    102114    <Compile Include="Interfaces\IValueConfiguration.cs" />
     115    <Compile Include="Manipulators\ParameterConfigurationAllPositionsManipulator.cs" />
     116    <Compile Include="Manipulators\ParameterConfigurationManipulator.cs" />
     117    <Compile Include="Manipulators\ParameterConfigurationOnePositionsManipulator.cs" />
    103118    <Compile Include="NullValue.cs" />
     119    <Compile Include="Operators\Crossovers\DoubleValue\AverageDoubleValueCrossover.cs" />
     120    <Compile Include="Operators\Crossovers\DoubleValue\DiscreteDoubleValueCrossover.cs" />
     121    <Compile Include="Operators\Crossovers\DoubleValue\NormalDoubleValueCrossover.cs" />
     122    <Compile Include="Operators\Crossovers\IntValue\AverageIntValueCrossover.cs" />
     123    <Compile Include="Operators\Crossovers\IntValue\DiscreteIntValueCrossover.cs" />
     124    <Compile Include="Operators\Crossovers\IntValue\MultiIntValueCrossover.cs" />
     125    <Compile Include="Operators\Crossovers\IntValue\NormalIntValueCrossover.cs" />
     126    <Compile Include="Operators\Interfaces\IDoubleValueCrossover.cs" />
     127    <Compile Include="Operators\Interfaces\IDoubleValueManipulator.cs" />
     128    <Compile Include="Operators\Interfaces\IIntValueCrossover.cs" />
     129    <Compile Include="Operators\Interfaces\IIntValueManipulator.cs" />
     130    <Compile Include="Operators\Interfaces\IValueManipulator.cs" />
     131    <Compile Include="Operators\Manipulators\DoubleValue\NormalDoubleValueManipulator.cs" />
     132    <Compile Include="Operators\Manipulators\DoubleValue\UniformDoubleValueManipulator.cs" />
     133    <Compile Include="Operators\Manipulators\IntValue\NormalIntValueManipulator.cs" />
     134    <Compile Include="Operators\Manipulators\IntValue\UniformIntValueManipulator.cs" />
    104135    <Compile Include="ParameterCombinationsEnumerator.cs" />
    105136    <Compile Include="ParameterConfigurations\ParameterConfiguration.cs" />
     
    126157    <None Include="HeuristicLab.snk" />
    127158  </ItemGroup>
    128   <ItemGroup />
     159  <ItemGroup>
     160    <Folder Include="Operators\Crossovers\SymbolicExpressionGrammar\" />
     161  </ItemGroup>
    129162  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    130163  <PropertyGroup>
  • branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/Interfaces/IRange.cs

    r8517 r8574  
    4242  }
    4343
    44   public interface IRange<T> : IRange, IItem where T : class {
     44  public interface IRange<T> : IRange where T : class {
    4545    new T LowerBound { get; set; }
    4646    new T UpperBound { get; set; }
  • branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/ParameterConfigurationTree.cs

    r8535 r8574  
    166166      get { return parameters; }
    167167      set { parameters = value; }
    168     }
    169 
    170     [Storable]
    171     private double experimentGenerationProgress;
    172     public double ExperimentGenerationProgress {
    173       get { return experimentGenerationProgress; }
    174       private set {
    175         if (experimentGenerationProgress != value) {
    176           experimentGenerationProgress = value;
    177           OnExperimentGenerationProgressChanged();
    178         }
    179       }
    180168    }
    181169
     
    291279      CombinationsCount = GetCombinationCount(0);
    292280    }
    293 
    294     public event EventHandler ExperimentGenerationProgressChanged;
    295     private void OnExperimentGenerationProgressChanged() {
    296       var handler = ExperimentGenerationProgressChanged;
    297       if (handler != null) handler(this, EventArgs.Empty);
    298     }
    299281    #endregion
    300282
     
    308290
    309291      algorithm.CollectParameterValues(this.Parameters);
    310     }
    311 
    312     public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions, Dictionary<IProblemInstanceProvider, HashSet<IDataDescriptor>> problemInstances, CancellationToken ct) {
    313       Experiment experiment = new Experiment();
    314       var algorithms = new List<IAlgorithm>(1 + problemInstances.Values.Count) { (IAlgorithm)algorithm.Clone() };
    315       foreach (var provider in problemInstances) {
    316         foreach (var descriptor in provider.Value) {
    317           var alg = (IAlgorithm)algorithm.Clone();
    318           ProblemInstanceManager.LoadData(provider.Key, descriptor, (IProblemInstanceConsumer)alg.Problem);
    319           algorithms.Add(alg);
    320         }
    321       }
    322       ExperimentGenerationProgress = 0;
    323       foreach (var alg in algorithms) {
    324         foreach (ParameterizedValueConfiguration combination in this) {
    325           ct.ThrowIfCancellationRequested();
    326           var clonedAlg = (IAlgorithm)alg.Clone();
    327           clonedAlg.Name = combination.ParameterInfoString;
    328           combination.Parameterize(clonedAlg);
    329           clonedAlg.StoreAlgorithmInEachRun = false;
    330           if (createBatchRuns) {
    331             BatchRun batchRun = new BatchRun(string.Format("BatchRun: {0}", combination.ParameterInfoString));
    332             batchRun.Optimizer = clonedAlg;
    333             batchRun.Repetitions = repetitions;
    334             experiment.Optimizers.Add(batchRun);
    335           } else {
    336             experiment.Optimizers.Add(clonedAlg);
    337           }
    338           ExperimentGenerationProgress = (double)experiment.Optimizers.Count / (this.GetCombinationCount(0) * algorithms.Count);
    339         }
    340       }
    341       return experiment;
    342     }
    343 
    344     public Experiment GenerateExperiment(IAlgorithm algorithm) {
    345       return GenerateExperiment(algorithm, false, 0, null, CancellationToken.None);
    346     }
    347 
    348     public Experiment GenerateExperiment(IAlgorithm algorithm, bool createBatchRuns, int repetitions) {
    349       return GenerateExperiment(algorithm, createBatchRuns, repetitions, null, CancellationToken.None);
    350292    }
    351293
  • branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/ParameterConfigurations/ParameterConfiguration.cs

    r8535 r8574  
    573573        }
    574574      }
     575
    575576      var clonedValue = this.ActualValue.Value != null ? (IItem)this.ActualValue.Value.Clone() : null;
    576577      if (clonedValue != null) AdaptValidValues(parameter, clonedValue);
    577       parameter.Value = clonedValue;
     578
     579      if (!(parameter is IFixedValueParameter)) {
     580        parameter.Value = clonedValue;
     581      } else {
     582        var original = (dynamic)parameter.Value;
     583        var clone = (dynamic)clonedValue;
     584        if (typeof(ValueTypeValue<>).IsAssignableFrom(parameter.DataType) && !original.ReadOnly) {
     585          original.Value = clone.Value;
     586        } else if (typeof(ValueTypeArray<>).IsAssignableFrom(parameter.DataType) && !original.ReadOnly) {
     587          for (int i = 0; i < original.Length; i++)
     588            original[i] = clone[i];
     589        } else if (typeof(ValueTypeMatrix<>).IsAssignableFrom(parameter.DataType) && !original.ReadOnly) {
     590          for (int i = 0; i < original.Rows; i++)
     591            for (int j = 0; j < original.Columns; j++)
     592              original[i, j] = clone[i, j];
     593        } // StringConvertibleValueTuple<,> not supported
     594      }
    578595    }
    579596
  • branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/Plugin.cs.frame

    r8524 r8574  
    3333  [PluginDependency("HeuristicLab.Core", "3.3")]
    3434  [PluginDependency("HeuristicLab.Data", "3.3")]
     35  [PluginDependency("HeuristicLab.Encodings.IntegerVectorEncoding", "3.3")]
     36  [PluginDependency("HeuristicLab.Encodings.RealVectorEncoding", "3.3")]
    3537  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
     38  [PluginDependency("HeuristicLab.Operators", "3.3")]
    3639  [PluginDependency("HeuristicLab.Optimization", "3.3")]
    3740  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3841  [PluginDependency("HeuristicLab.Persistence", "3.3")]
     42  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
    3943  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")]
    4044  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
     45  [PluginDependency("HeuristicLab.Random", "3.3")]
    4146  public class HeuristicLabEncodingsParameterConfigurationEncodingPlugin : PluginBase {
    4247  }
  • branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/RangeConstraints/Range.cs

    r8535 r8574  
    219219        errorMessage = "Could not parse range."; return false;
    220220      }
    221 
    222221      if (lowerBound.SetValue(parts2[0]) &&
    223222          upperBound.SetValue(parts2[1]) &&
Note: See TracChangeset for help on using the changeset viewer.