1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2015 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.Scilab {
|
---|
30 | [Item("Scilab Parameter Optimization Problem", "Optimization of a parameter vector which is evaluated in Scilab.")]
|
---|
31 | [StorableType("EC12BD13-C477-4E4E-9B9F-A229898A1E22")]
|
---|
32 | [Creatable(CreatableAttribute.Categories.ExternalEvaluationProblems, Priority = 120)]
|
---|
33 | public class ScilabParameterOptimizationProblem : ParameterOptimizationProblem {
|
---|
34 | private const string QualityVariableParameterName = "QualityVariableName";
|
---|
35 | private const string ScilabEvaluationScriptParameterName = "ScilabEvaluationScript";
|
---|
36 | private const string ScilabInitializationScriptParameterName = "ScilabInitializationScript";
|
---|
37 |
|
---|
38 | #region parameters
|
---|
39 | public IFixedValueParameter<StringValue> QualityVariableParameter {
|
---|
40 | get { return (IFixedValueParameter<StringValue>)Parameters[QualityVariableParameterName]; }
|
---|
41 | }
|
---|
42 | public IFixedValueParameter<TextFileValue> ScilabEvaluationScriptParameter {
|
---|
43 | get { return (IFixedValueParameter<TextFileValue>)Parameters[ScilabEvaluationScriptParameterName]; }
|
---|
44 | }
|
---|
45 | public IFixedValueParameter<TextFileValue> ScilabInitializationScriptParameter {
|
---|
46 | get { return (IFixedValueParameter<TextFileValue>)Parameters[ScilabInitializationScriptParameterName]; }
|
---|
47 | }
|
---|
48 | #endregion
|
---|
49 |
|
---|
50 | #region properties
|
---|
51 | public string QualityVariable {
|
---|
52 | get { return QualityVariableParameter.Value.Value; }
|
---|
53 | set { QualityVariableParameter.Value.Value = value; }
|
---|
54 | }
|
---|
55 | public TextFileValue ScilabEvaluationScript {
|
---|
56 | get { return ScilabEvaluationScriptParameter.Value; }
|
---|
57 | }
|
---|
58 | public TextFileValue ScilabInitializationScript {
|
---|
59 | get { return ScilabInitializationScriptParameter.Value; }
|
---|
60 | }
|
---|
61 |
|
---|
62 | #endregion
|
---|
63 |
|
---|
64 | [StorableConstructor]
|
---|
65 | protected ScilabParameterOptimizationProblem(bool deserializing) : base(deserializing) { }
|
---|
66 | protected ScilabParameterOptimizationProblem(ScilabParameterOptimizationProblem original, Cloner cloner)
|
---|
67 | : base(original, cloner) {
|
---|
68 | }
|
---|
69 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
70 | return new ScilabParameterOptimizationProblem(this, cloner);
|
---|
71 | }
|
---|
72 |
|
---|
73 | public ScilabParameterOptimizationProblem()
|
---|
74 | : base(new ScilabParameterVectorEvaluator()) {
|
---|
75 | Parameters.Add(new FixedValueParameter<StringValue>(QualityVariableParameterName, "The name of the quality variable of the Scilab script.", new StringValue("quality")));
|
---|
76 | Parameters.Add(new FixedValueParameter<TextFileValue>(ScilabEvaluationScriptParameterName, "The path to the Scilab evaluation script.", new TextFileValue()));
|
---|
77 | Parameters.Add(new FixedValueParameter<TextFileValue>(ScilabInitializationScriptParameterName, "The path to a Scilab script that should be executed once when the algorithm starts.", new TextFileValue()));
|
---|
78 |
|
---|
79 | ScilabEvaluationScript.FileDialogFilter = @"Scilab Scripts|*.sce|All files|*.*";
|
---|
80 | ScilabInitializationScript.FileDialogFilter = @"Scilab Scripts|*.sce|All files|*.*";
|
---|
81 | }
|
---|
82 | }
|
---|
83 | }
|
---|