[9690] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[12012] | 3 | * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[9690] | 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using HeuristicLab.Common;
|
---|
| 23 | using HeuristicLab.Core;
|
---|
| 24 | using HeuristicLab.Data;
|
---|
| 25 | using HeuristicLab.Parameters;
|
---|
| 26 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 27 | using HeuristicLab.Problems.ParameterOptimization;
|
---|
| 28 |
|
---|
| 29 | namespace HeuristicLab.Problems.ExternalEvaluation.Matlab {
|
---|
[9748] | 30 | [Item("MATLAB Parameter Optimization Problem", "Optimization of a parameter vector which is evaluated in MATLAB.")]
|
---|
[9690] | 31 | [StorableClass]
|
---|
[12504] | 32 | [Creatable(CreatableAttribute.Categories.ExternalEvaluationProblems, Priority = 110)]
|
---|
[9690] | 33 | public class MatlabParameterOptimizationProblem : ParameterOptimizationProblem {
|
---|
| 34 | private const string QualityVariableParameterName = "QualityVariableName";
|
---|
[9748] | 35 | private const string MatlabEvaluationScriptParameterName = "MATLABEvaluationScript";
|
---|
[11029] | 36 | private const string MatlabInitializationScriptParameterName = "MATLABInitializationScript";
|
---|
[9690] | 37 |
|
---|
| 38 | #region parameters
|
---|
| 39 | public IFixedValueParameter<StringValue> QualityVariableParameter {
|
---|
| 40 | get { return (IFixedValueParameter<StringValue>)Parameters[QualityVariableParameterName]; }
|
---|
| 41 | }
|
---|
[9715] | 42 | public IFixedValueParameter<TextFileValue> MatlabEvaluationScriptParameter {
|
---|
| 43 | get { return (IFixedValueParameter<TextFileValue>)Parameters[MatlabEvaluationScriptParameterName]; }
|
---|
[9690] | 44 | }
|
---|
[11029] | 45 | public IFixedValueParameter<TextFileValue> MatlabInitializationScriptParameter {
|
---|
| 46 | get { return (IFixedValueParameter<TextFileValue>)Parameters[MatlabInitializationScriptParameterName]; }
|
---|
| 47 | }
|
---|
[9690] | 48 | #endregion
|
---|
| 49 |
|
---|
| 50 | #region properties
|
---|
| 51 | public string QualityVariable {
|
---|
| 52 | get { return QualityVariableParameter.Value.Value; }
|
---|
| 53 | set { QualityVariableParameter.Value.Value = value; }
|
---|
| 54 | }
|
---|
[9715] | 55 | public TextFileValue MatlabEvaluationScript {
|
---|
[9690] | 56 | get { return MatlabEvaluationScriptParameter.Value; }
|
---|
| 57 | }
|
---|
[11029] | 58 | public TextFileValue MatlabInitializationScript {
|
---|
| 59 | get { return MatlabInitializationScriptParameter.Value; }
|
---|
| 60 | }
|
---|
[9690] | 61 | #endregion
|
---|
| 62 |
|
---|
| 63 | [StorableConstructor]
|
---|
| 64 | protected MatlabParameterOptimizationProblem(bool deserializing) : base(deserializing) { }
|
---|
| 65 | protected MatlabParameterOptimizationProblem(MatlabParameterOptimizationProblem original, Cloner cloner)
|
---|
| 66 | : base(original, cloner) {
|
---|
| 67 | }
|
---|
| 68 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 69 | return new MatlabParameterOptimizationProblem(this, cloner);
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | public MatlabParameterOptimizationProblem()
|
---|
| 73 | : base(new MatlabParameterVectorEvaluator()) {
|
---|
[9748] | 74 | Parameters.Add(new FixedValueParameter<StringValue>(QualityVariableParameterName, "The name of the quality variable of the MATLAB script.", new StringValue("quality")));
|
---|
| 75 | Parameters.Add(new FixedValueParameter<TextFileValue>(MatlabEvaluationScriptParameterName, "The path to the MATLAB evaluation script.", new TextFileValue()));
|
---|
[11094] | 76 | Parameters.Add(new FixedValueParameter<TextFileValue>(MatlabInitializationScriptParameterName, "The path to a MATLAB script for initialization that should be executed once before the algorithm starts.", new TextFileValue()));
|
---|
[9690] | 77 |
|
---|
[9748] | 78 | MatlabEvaluationScript.FileDialogFilter = @"MATLAB Scripts|*.m|All files|*.*";
|
---|
[9690] | 79 | }
|
---|
| 80 | }
|
---|
| 81 | }
|
---|