Changeset 14379 for branches/HeuristicLab.GoalSeekingProblem
- Timestamp:
- 11/09/16 14:55:10 (8 years ago)
- Location:
- branches/HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem/3.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem/3.4/GoalSeekingUtil.cs
r14336 r14379 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2016 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 System; 2 23 using System.Collections.Generic; 3 24 using System.Linq; … … 61 82 } 62 83 return encoding; 84 } 85 86 internal static void UpdateEncoding(RealVectorEncoding encoding, IEnumerable<InputParameter> inputParameters) { 87 encoding.Length = inputParameters.Count(); 88 encoding.Bounds = new DoubleMatrix(encoding.Length, 2); 89 encoding.Bounds.RowNames = inputParameters.Select(x => x.Name); 90 encoding.Bounds.ColumnNames = new[] { "Min.", "Max." }; 91 92 int i = 0; 93 foreach (var parameter in inputParameters) { 94 encoding.Bounds[i, 0] = parameter.Min; 95 encoding.Bounds[i, 1] = parameter.Max; 96 ++i; 97 } 63 98 } 64 99 -
branches/HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem/3.4/MultiObjectiveGoalSeekingProblem.cs
r14338 r14379 53 53 get { return (IValueParameter<CheckedItemList<GoalParameter>>)Parameters[GoalsParameterName]; } 54 54 } 55 public IFixedValueParameter<Item Collection<IRegressionModel>> ModelsParameter {56 get { return (IFixedValueParameter<Item Collection<IRegressionModel>>)Parameters[ModelsParameterName]; }55 public IFixedValueParameter<ItemList<IRegressionModel>> ModelsParameter { 56 get { return (IFixedValueParameter<ItemList<IRegressionModel>>)Parameters[ModelsParameterName]; } 57 57 } 58 58 public IFixedValueParameter<DoubleValue> QualitySumCutoffParameter { … … 154 154 Parameters.Add(new ValueParameter<CheckedItemList<InputParameter>>(InputsParameterName)); 155 155 Parameters.Add(new ValueParameter<CheckedItemList<GoalParameter>>(GoalsParameterName)); 156 Parameters.Add(new FixedValueParameter<Item Collection<IRegressionModel>>(ModelsParameterName, new ItemCollection<IRegressionModel>()));156 Parameters.Add(new FixedValueParameter<ItemList<IRegressionModel>>(ModelsParameterName, new ItemList<IRegressionModel>())); 157 157 Parameters.Add(new FixedValueParameter<DoubleValue>(QualitySumCutoffParameterName, new DoubleValue(0.2))); 158 158 QualitySumCutoffParameter.Hidden = true; … … 228 228 for (int j = 0; j < activeParameters.Count * 3; j += 3) { 229 229 int k = j + offset; 230 rowValues[k] = 0; // TODO: figure this out and fix230 rowValues[k] = activeParameters[j / 3].Value; 231 231 rowValues[k + 1] = vector[j / 3]; 232 232 rowValues[k + 2] = rowValues[k + 1] - rowValues[k]; … … 261 261 } 262 262 263 private void ModelCollection_ItemsChanged(object sender, CollectionItemsChangedEventArgs<I RegressionModel> e) {263 private void ModelCollection_ItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<IRegressionModel>> e) { 264 264 if (e.Items == null || !e.Items.Any()) return; 265 265 GoalSeekingUtil.UpdateInputs(InputsParameter.Value, Models, InputParameterChanged); 266 Encoding = GoalSeekingUtil.CreateEncoding(ActiveInputs);266 GoalSeekingUtil.UpdateEncoding(Encoding, ActiveInputs); 267 267 dataset = Inputs.Any() ? new ModifiableDataset(Inputs.Select(x => x.Name), Inputs.Select(x => new List<double> { x.Value })) : new ModifiableDataset(); 268 268 GoalSeekingUtil.UpdateTargets(GoalsParameter.Value, Models, GoalParameterChanged); … … 275 275 if (inputs.ItemChecked(inputParameter) != inputParameter.Active) 276 276 inputs.SetItemCheckedState(inputParameter, inputParameter.Active); 277 Encoding = GoalSeekingUtil.CreateEncoding(ActiveInputs);277 GoalSeekingUtil.UpdateEncoding(Encoding, ActiveInputs); 278 278 } 279 279 -
branches/HeuristicLab.GoalSeekingProblem/HeuristicLab.GoalSeekingProblem/3.4/SingleObjectiveGoalSeekingProblem.cs
r14338 r14379 51 51 get { return (IValueParameter<CheckedItemList<GoalParameter>>)Parameters[GoalsParameterName]; } 52 52 } 53 public IFixedValueParameter<Item Collection<IRegressionModel>> ModelsParameter {54 get { return (IFixedValueParameter<Item Collection<IRegressionModel>>)Parameters[ModelsParameterName]; }53 public IFixedValueParameter<ItemList<IRegressionModel>> ModelsParameter { 54 get { return (IFixedValueParameter<ItemList<IRegressionModel>>)Parameters[ModelsParameterName]; } 55 55 } 56 56 #endregion … … 139 139 Parameters.Add(new ValueParameter<CheckedItemList<InputParameter>>(InputsParameterName)); 140 140 Parameters.Add(new ValueParameter<CheckedItemList<GoalParameter>>(GoalsParameterName)); 141 Parameters.Add(new FixedValueParameter<Item Collection<IRegressionModel>>(ModelsParameterName, new ItemCollection<IRegressionModel>()));141 Parameters.Add(new FixedValueParameter<ItemList<IRegressionModel>>(ModelsParameterName, new ItemList<IRegressionModel>())); 142 142 EncodingParameter.Hidden = true; 143 143 EvaluatorParameter.Hidden = true; … … 176 176 } 177 177 178 private void ModelCollection_ItemsChanged(object sender, CollectionItemsChangedEventArgs<I RegressionModel> e) {178 private void ModelCollection_ItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<IRegressionModel>> e) { 179 179 if (e.Items == null || !e.Items.Any()) return; 180 180 GoalSeekingUtil.UpdateInputs(InputsParameter.Value, Models, InputParameterChanged); 181 Encoding = GoalSeekingUtil.CreateEncoding(ActiveInputs);181 GoalSeekingUtil.UpdateEncoding(Encoding, ActiveInputs); 182 182 dataset = Inputs.Any() ? new ModifiableDataset(Inputs.Select(x => x.Name), Inputs.Select(x => new List<double> { x.Value })) : new ModifiableDataset(); 183 183 GoalSeekingUtil.UpdateTargets(GoalsParameter.Value, Models, GoalParameterChanged); … … 190 190 if (inputs.ItemChecked(inputParameter) != inputParameter.Active) 191 191 inputs.SetItemCheckedState(inputParameter, inputParameter.Active); 192 Encoding = GoalSeekingUtil.CreateEncoding(ActiveInputs);192 GoalSeekingUtil.UpdateEncoding(Encoding, ActiveInputs); 193 193 } 194 194
Note: See TracChangeset
for help on using the changeset viewer.