Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/11/19 16:30:22 (5 years ago)
Author:
msemenki
Message:

#2988:

  1. The file system was changed, folders was added and part of files was transferred in these folders.
  2. HelpFunctions class was divided on 2 parts: HelpFuctions for common purposes static functions and SelfConfiguration that include functions for self-configuration mechanism realization (is used in EMMSucsessMap).
  3. Parts of self-configuration mechanism was transferred from EMMSucsessMap.cs to SelfConfiguration.cs. Now EMMSucsessMap used SelfConfiguration like one of data member. Other parts of project was adopted for this changing.
  4. FileComunication class was added. It include the majority of functions for printing to files or reading from files. Here were realized possibility to write and read to hl files.
  5. ModelTreeNode.cs has additional possibility - to write sub-model in string (then it is possible to write it in file).
  6. InfixExpressionFormatter.cs can work with TreeModelNode.
  7. Possibility for different map types to be readable from files was extended and cheeked.
  8. Such parameters like - ClusterNumbers, ClusterNumbersShow, NegbourNumber, NegbourType (that is used only in several maps) was transferred from EMMAlgorithm to Map Parameters. Now EMMBaseMap class inherited from ParameterizedNamedItem (not from Item). And EMMIslandMap and EMMNetworkMap contains their parameters (constructors was modified). CreationMap calls functions were simplified.
  9. Functions for different distance metric calculation was added. Now, it is possible to calculate different types of distances between models (with different random values of constants).
  10. DistanceParametr was added. Now maps can be created according different types of distance calculations.
  11. The class EMMClustering has new name KMeansClusterizationAlgorithm. On KMeansClusterizationAlgorithm bug with bloating of centroids list was fixed. Algorithm was adopted for working with different type of distance metric and get maximum number of iterations.
  12. Possibilities for constants optimization in sub-models an whole tree was added. EMMAlgorithm get new function for evaluation of individuals (and some additional technical stuff for that). Function for trees with model in usual tree transformation and back was added.
  13. EMMAlgorithm was divided on 2 parts:
  • EMMAlgorithm, that contain evolutionary algorithm working with sub-models, and use ready to use maps;
  • ModelSetPreparation, that contain distance calculation, model set simplification and map creation.
Location:
branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm
Files:
1 added
1 moved

Legend:

Unmodified
Added
Removed
  • branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm/EMMBaseAlgorithm.cs

    r17133 r17134  
    4141
    4242namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
    43   [Item("MOEADAlgorithmBase", "Base class for all MOEA/D algorithm variants.")]
     43  [Item("EMMAlgorithmBase", "Base class for all EMM algorithm variants.")]
    4444  [StorableType("A56A396B-965A-4ADE-8A2B-AE3A45F9C239")]
    4545  public abstract class EvolvmentModelsOfModelsAlgorithmBase : FixedDataAnalysisAlgorithm<ISymbolicDataAnalysisSingleObjectiveProblem> {
     
    7878    private const string AnalyzerParameterName = "Analyzer";
    7979    private const string InputFileParameterName = "InputFile";
    80     private const string ClusterNumbersParameterName = "ClusterNumbers";
    81     private const string ClusterNumbersShowParameterName = "ClusterNumbersShow";
    8280    private const string AlgorithmImplementationTypeParameterName = "AlgorithmImplementationType";
     81    private const string DistanceTypeParameterName = "DistanceType";
    8382    private const string MapParameterName = "Map";
    84     private const string NegbourTypeParameterName = "NegbourType";
    85     private const string NegbourNumberParameterName = "NegbourNumber";
    8683    public IValueParameter<MultiAnalyzer> AnalyzerParameter {
    8784      get { return (ValueParameter<MultiAnalyzer>)Parameters[AnalyzerParameterName]; }
     
    9087      get { return (IFixedValueParameter<IntValue>)Parameters[SeedParameterName]; }
    9188    }
    92     public IValueParameter<IntValue> ClusterNumbersParameter {
    93       get { return (IValueParameter<IntValue>)Parameters[ClusterNumbersParameterName]; }
    94     }
    95     public IValueParameter<IntValue> ClusterNumbersShowParameter {
    96       get { return (IValueParameter<IntValue>)Parameters[ClusterNumbersShowParameterName]; }
    97     }
    9889    public IConstrainedValueParameter<StringValue> AlgorithmImplementationTypeParameter {
    9990      get { return (IConstrainedValueParameter<StringValue>)Parameters[AlgorithmImplementationTypeParameterName]; }
    10091    }
     92    public IConstrainedValueParameter<StringValue> DistanceTypeParameter {
     93      get { return (IConstrainedValueParameter<StringValue>)Parameters[DistanceTypeParameterName]; }
     94    }
    10195    public IConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
    10296      get { return (IConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
    10397    }
    104     public IFixedValueParameter<StringValue> NegbourTypeParameter {
    105       get { return (IFixedValueParameter<StringValue>)Parameters[NegbourTypeParameterName]; }
    106     }
    107     public IFixedValueParameter<IntValue> NegbourNumberParameter {
    108       get { return (IFixedValueParameter<IntValue>)Parameters[NegbourNumberParameterName]; }
    109     }
     98
    11099    public IFixedValueParameter<StringValue> InputFileParameter {
    111100      get { return (IFixedValueParameter<StringValue>)Parameters[InputFileParameterName]; }
     
    151140      set { SeedParameter.Value.Value = value; }
    152141    }
    153     public IntValue ClusterNumbers {
    154       get { return ClusterNumbersParameter.Value; }
    155       set { ClusterNumbersParameter.Value = value; }
    156     }
    157     public IntValue ClusterNumbersShow {
    158       get { return ClusterNumbersShowParameter.Value; }
    159       set { ClusterNumbersShowParameter.Value = value; }
    160     }
    161142    public StringValue AlgorithmImplemetationType {
    162143      get { return AlgorithmImplementationTypeParameter.Value; }
    163144      set { AlgorithmImplementationTypeParameter.Value.Value = value.Value; }
    164145    }
     146    public StringValue DistanceType {
     147      get { return DistanceTypeParameter.Value; }
     148      set { DistanceTypeParameter.Value.Value = value.Value; }
     149    }
    165150    public EMMMapBase<ISymbolicExpressionTree> Map {
    166151      get { return MapParameter.Value; }
    167152      set { MapParameter.Value = value; }
    168153    }
    169     public StringValue NegbourType {
    170       get { return NegbourTypeParameter.Value; }
    171       set { NegbourTypeParameter.Value.Value = value.Value; }
    172     }
    173     public IntValue NegbourNumber {
    174       get { return NegbourNumberParameter.Value; }
    175       set { NegbourNumberParameter.Value.Value = value.Value; }
    176     }
    177154    public StringValue InputFile {
    178155      get { return InputFileParameter.Value; }
     
    229206      Parameters.Add(new FixedValueParameter<IntValue>(SeedParameterName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
    230207      Parameters.Add(new FixedValueParameter<StringValue>(InputFileParameterName, "The file with set of models that will be.", new StringValue("input.txt")));
    231       Parameters.Add(new ConstrainedValueParameter<StringValue>(AlgorithmImplementationTypeParameterName, "The Type of possible algorith, implemetation, choose one: OnlyMap, Full, Read."));
    232       Parameters.Add(new ConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName, "The type of map crearion algorithm. Use one from: IslandMap, NetworkMap."));
    233       Parameters.Add(new FixedValueParameter<IntValue>(NegbourNumberParameterName, "The parametr for FullMap type of map crearion algorithm. Use one from: 10, 20.", new IntValue(10)));
    234       Parameters.Add(new FixedValueParameter<StringValue>(NegbourTypeParameterName, "The parametr for FullMap type of map crearion algorithm. Use one from: Percent, Number.", new StringValue("Number")));
     208      Parameters.Add(new ConstrainedValueParameter<StringValue>(AlgorithmImplementationTypeParameterName, "The Type of possible algorithm, implementation, choose one: OnlyMap, Full, Read."));
     209      Parameters.Add(new ConstrainedValueParameter<StringValue>(DistanceTypeParameterName, "The Type of possible distance calculator for case of only distance calculation."));
     210      Parameters.Add(new ConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName, "The type of map creation algorithm. Use one from: IslandMap, NetworkMap."));
    235211      Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyParameterName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
    236212      Parameters.Add(new ValueParameter<IntValue>(PopulationSizeParameterName, "The size of the population of Solutions.", new IntValue(100)));
    237       Parameters.Add(new ConstrainedValueParameter<ISelector>(SelectorParameterName, "The operator used to sellect parents."));
     213      Parameters.Add(new ConstrainedValueParameter<ISelector>(SelectorParameterName, "The operator used to select parents."));
    238214      Parameters.Add(new ValueParameter<PercentValue>(CrossoverProbabilityParameterName, "The probability that the crossover operator is applied.", new PercentValue(0.9)));
    239215      Parameters.Add(new ValueParameter<IntValue>(GroupSizeParameterName, "The GoupSize that the Selector operator is applied.", new IntValue(3)));
     
    244220      Parameters.Add(new ValueParameter<IntValue>(MaximumEvaluatedSolutionsParameterName, "The maximum number of evaluated Solutions (approximately).", new IntValue(100_000)));
    245221      Parameters.Add(new ValueParameter<IRandom>(RandomParameterName, new MersenneTwister()));
    246       Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite Solutions which are kept in each generation.", new IntValue(1)));
    247       Parameters.Add(new ValueParameter<IntValue>(ClusterNumbersParameterName, "The number of clusters for model Map.", new IntValue(10)));
    248       Parameters.Add(new ValueParameter<IntValue>(ClusterNumbersShowParameterName, "The number of clusters for model Map.", new IntValue(10)));
     222      Parameters.Add(new ValueParameter<IntValue>("Elites", "The number of elite Solutions which are kept in each generation.", new IntValue(1)));
    249223      foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
    250224        SelectorParameter.ValidValues.Add(selector);
     
    274248      if (Problem != null) {
    275249        Problem.SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeBatchInterpreter();
    276         //Problem.SymbolicExpressionTreeGrammar = new EMMGrammar();
    277250      }
    278251    }
    279252    protected void MapParameterUpdate() {
    280       int neghboorNumber = 10;
    281 
    282       switch (NegbourType.Value) {
    283         case "Percent": neghboorNumber = Convert.ToInt32((Convert.ToDouble(ClusterNumbersParameter.Value.Value)) * (Convert.ToDouble(NegbourNumber.Value)) / 100.0); break;
    284         case "Number": neghboorNumber = NegbourNumber.Value; break;
    285         default: neghboorNumber = NegbourNumber.Value; break;
    286       }
    287253      var mapTypes = new EMMMapBase<ISymbolicExpressionTree>[]
    288254      {
    289255        new EMMIslandMap(),
    290         new EMMNetworkMap(neghboorNumber),
     256        new EMMNetworkMap(),
    291257        new EMMDisatanceMap(),
    292258        new EMMRankMap(),
     
    301267          new StringValue("Full"),
    302268          new StringValue("Read"),
    303           new StringValue ("OnlyMap")
    304269        };
    305270      foreach (var t in algorithmType) {
    306271        AlgorithmImplementationTypeParameter.ValidValues.Add(t);
    307272      }
     273      var distanceType = new StringValue[]
     274        {
     275          new StringValue("MSE"),
     276          new StringValue("PearsonsRSquared"),
     277          new StringValue ("Covariance"),
     278          new StringValue ("MaxAbsoluteError"),
     279          new StringValue ("MeanAbsoluteError"),
     280          new StringValue ("Symbolic")
     281        };
     282      foreach (var t in distanceType) {
     283        DistanceTypeParameter.ValidValues.Add(t);
     284      }
    308285    }
    309286
     
    320297      }
    321298
    322       //if (original.offspringPopulation != null) {
    323       //  offspringPopulation = original.offspringPopulation.Select(cloner.Clone).ToList();
    324       //}
    325 
    326       //if (original.jointPopulation != null) {
    327       //  jointPopulation = original.jointPopulation.Select(x => cloner.Clone(x)).ToList();
    328       //}
    329 
    330299      if (original.executionContext != null) {
    331300        executionContext = cloner.Clone(original.executionContext);
     
    335304        globalScope = cloner.Clone(original.globalScope);
    336305      }
    337 
    338       // hack
    339       trees = original.trees.Select(x => cloner.Clone(x)).ToArray();
     306      // hack
     307      if (original.trees != null) {
     308        trees = original.trees.Select(x => cloner.Clone(x)).ToArray();
     309      }
    340310    }
    341311
Note: See TracChangeset for help on using the changeset viewer.