Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/17/15 11:47:52 (8 years ago)
Author:
gkronber
Message:

#2385: added CreateSolution flag to Gaussian process algorithms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs

    r12504 r13205  
    2525using HeuristicLab.Common;
    2626using HeuristicLab.Core;
     27using HeuristicLab.Data;
    2728using HeuristicLab.Optimization;
    2829using HeuristicLab.Parameters;
     
    4849
    4950    private const string ModelParameterName = "Model";
     51    private const string CreateSolutionParameterName = "CreateSolution";
     52
    5053
    5154    #region parameter properties
     
    5558    public IFixedValueParameter<GaussianProcessRegressionSolutionCreator> GaussianProcessSolutionCreatorParameter {
    5659      get { return (IFixedValueParameter<GaussianProcessRegressionSolutionCreator>)Parameters[SolutionCreatorParameterName]; }
     60    }
     61    public IFixedValueParameter<BoolValue> CreateSolutionParameter {
     62      get { return (IFixedValueParameter<BoolValue>)Parameters[CreateSolutionParameterName]; }
     63    }
     64    #endregion
     65    #region properties
     66    public bool CreateSolution {
     67      get { return CreateSolutionParameter.Value.Value; }
     68      set { CreateSolutionParameter.Value.Value = value; }
    5769    }
    5870    #endregion
     
    7890      Parameters.Add(new ConstrainedValueParameter<IGaussianProcessRegressionModelCreator>(ModelCreatorParameterName, "The operator to create the Gaussian process model.",
    7991        new ItemSet<IGaussianProcessRegressionModelCreator>(modelCreators), defaultModelCreator));
    80       // this parameter is not intended to be changed,
     92      // the solution creator cannot be changed
    8193      Parameters.Add(new FixedValueParameter<GaussianProcessRegressionSolutionCreator>(SolutionCreatorParameterName, "The solution creator for the algorithm",
    8294        new GaussianProcessRegressionSolutionCreator()));
    8395      Parameters[SolutionCreatorParameterName].Hidden = true;
     96      // TODO: it would be better to deactivate the solution creator when this parameter is changed
     97      Parameters.Add(new FixedValueParameter<BoolValue>(CreateSolutionParameterName, "Flag that indicates if a solution should be produced at the end of the run", new BoolValue(true)));
     98      Parameters[CreateSolutionParameterName].Hidden = true;
    8499
    85100      ParameterizedModelCreators();
     
    91106    [StorableHook(HookType.AfterDeserialization)]
    92107    private void AfterDeserialization() {
     108      // BackwardsCompatibility3.3
     109      #region Backwards compatible code, remove with 3.4
     110      if (!Parameters.ContainsKey(CreateSolutionParameterName)) {
     111        Parameters.Add(new FixedValueParameter<BoolValue>(CreateSolutionParameterName, "Flag that indicates if a solution should be produced at the end of the run", new BoolValue(true)));
     112        Parameters[CreateSolutionParameterName].Hidden = true;
     113      }
     114      #endregion
    93115      RegisterEventHandlers();
    94116    }
Note: See TracChangeset for help on using the changeset viewer.