1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
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 {
|
---|
30 | [Item("MATLAB Parameter Optimization Problem", "Optimization of a parameter vector which is evaluated in MATLAB.")]
|
---|
31 | [StorableClass]
|
---|
32 | [Creatable("Problems")]
|
---|
33 | public class MatlabParameterOptimizationProblem : ParameterOptimizationProblem {
|
---|
34 | private const string QualityVariableParameterName = "QualityVariableName";
|
---|
35 | private const string MatlabEvaluationScriptParameterName = "MATLABEvaluationScript";
|
---|
36 |
|
---|
37 | #region parameters
|
---|
38 | public IFixedValueParameter<StringValue> QualityVariableParameter {
|
---|
39 | get { return (IFixedValueParameter<StringValue>)Parameters[QualityVariableParameterName]; }
|
---|
40 | }
|
---|
41 | public IFixedValueParameter<TextFileValue> MatlabEvaluationScriptParameter {
|
---|
42 | get { return (IFixedValueParameter<TextFileValue>)Parameters[MatlabEvaluationScriptParameterName]; }
|
---|
43 | }
|
---|
44 | #endregion
|
---|
45 |
|
---|
46 | #region properties
|
---|
47 | public string QualityVariable {
|
---|
48 | get { return QualityVariableParameter.Value.Value; }
|
---|
49 | set { QualityVariableParameter.Value.Value = value; }
|
---|
50 | }
|
---|
51 | public TextFileValue MatlabEvaluationScript {
|
---|
52 | get { return MatlabEvaluationScriptParameter.Value; }
|
---|
53 | }
|
---|
54 | #endregion
|
---|
55 |
|
---|
56 | [StorableConstructor]
|
---|
57 | protected MatlabParameterOptimizationProblem(bool deserializing) : base(deserializing) { }
|
---|
58 | protected MatlabParameterOptimizationProblem(MatlabParameterOptimizationProblem original, Cloner cloner)
|
---|
59 | : base(original, cloner) {
|
---|
60 | }
|
---|
61 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
62 | return new MatlabParameterOptimizationProblem(this, cloner);
|
---|
63 | }
|
---|
64 |
|
---|
65 | public MatlabParameterOptimizationProblem()
|
---|
66 | : base(new MatlabParameterVectorEvaluator()) {
|
---|
67 | Parameters.Add(new FixedValueParameter<StringValue>(QualityVariableParameterName, "The name of the quality variable of the MATLAB script.", new StringValue("quality")));
|
---|
68 | Parameters.Add(new FixedValueParameter<TextFileValue>(MatlabEvaluationScriptParameterName, "The path to the MATLAB evaluation script.", new TextFileValue()));
|
---|
69 |
|
---|
70 | MatlabEvaluationScript.FileDialogFilter = @"MATLAB Scripts|*.m|All files|*.*";
|
---|
71 | }
|
---|
72 | }
|
---|
73 | }
|
---|