- Timestamp:
- 09/25/15 14:39:59 (9 years ago)
- Location:
- branches/gteufl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gteufl
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll 25 obj
-
- Property svn:mergeinfo changed
-
Property
svn:global-ignores
set to
*.nuget
packages
- Property svn:ignore
-
branches/gteufl/HeuristicLab.Optimizer
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/HLScript/HeuristicLab.Optimizer merged eligible /branches/HiveStatistics/sources/HeuristicLab.Optimizer merged eligible /stable/HeuristicLab.Optimizer merged eligible /trunk/sources/HeuristicLab.Optimizer merged eligible /branches/1721-RandomForestPersistence/HeuristicLab.Optimizer 10321-10322 /branches/Algorithms.GradientDescent/HeuristicLab.Optimizer 5516-5520 /branches/Benchmarking/sources/HeuristicLab.Optimizer 6917-7005 /branches/CloningRefactoring/HeuristicLab.Optimizer 4656-4721 /branches/CodeEditor/HeuristicLab.Optimizer 11700-11806 /branches/DataAnalysis Refactoring/HeuristicLab.Optimizer 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Optimizer 5815-6180 /branches/DataAnalysis/HeuristicLab.Optimizer 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.Optimizer 10085-11101 /branches/EnumValue in CreateExperiment/HeuristicLab.Optimizer 12251-12678 /branches/GP.Grammar.Editor/HeuristicLab.Optimizer 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Optimizer 5060 /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Optimizer 11570-12508 /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Optimizer 6123-9799 /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Optimizer 11130-12721 /branches/LogResidualEvaluator/HeuristicLab.Optimizer 10202-10483 /branches/NET40/sources/HeuristicLab.Optimizer 5138-5162 /branches/NSGA-II Changes/HeuristicLab.Optimizer 12033-12122 /branches/NewItemDialog/HeuristicLab.Optimizer 12184-12284 /branches/ParallelEngine/HeuristicLab.Optimizer 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Optimizer 7568-7810 /branches/QAPAlgorithms/HeuristicLab.Optimizer 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Optimizer 6828 /branches/RuntimeOptimizer/HeuristicLab.Optimizer 8943-9078 /branches/ScatterSearch (trunk integration)/HeuristicLab.Optimizer 7787-8333 /branches/SlaveShutdown/HeuristicLab.Optimizer 8944-8956 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Optimizer 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.Optimizer 5370-5682 /branches/Trunk/HeuristicLab.Optimizer 6829-6865 /branches/UnloadJobs/HeuristicLab.Optimizer 9168-9215 /branches/VNS/HeuristicLab.Optimizer 5594-5752 /branches/histogram/HeuristicLab.Optimizer 5959-6341
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/gteufl/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.cs
r9521 r12969 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 169 169 else boolParameters.Remove(parameter); 170 170 } 171 172 bool isEnumValue = parameter.Value != null && parameter.Value.GetType().IsGenericType 173 && typeof(EnumValue<>).IsAssignableFrom(parameter.Value.GetType().GetGenericTypeDefinition()); 174 if (isEnumValue) { 175 if (e.Item.Checked) multipleChoiceParameters.Add(parameter, new HashSet<IItem>(new EnumValueEqualityComparer())); 176 else multipleChoiceParameters.Remove(parameter); 177 } 171 178 } 172 179 … … 192 199 isOptionalConstrainedValueParameter 193 200 || typeof(ConstrainedValueParameter<>).Equals(parameter.GetType().GetGenericTypeDefinition()); 194 195 if (isConstrainedValueParameter) { 201 bool isEnumValue = parameter.Value != null && parameter.Value.GetType().IsGenericType 202 && typeof(EnumValue<>).IsAssignableFrom(parameter.Value.GetType().GetGenericTypeDefinition()); 203 204 if (isConstrainedValueParameter || isEnumValue) { 196 205 detailsTypeLabel.Text = "Choices:"; 197 206 choicesListView.Tag = parameter; 198 207 199 if (isOptionalConstrainedValueParameter) { 200 choicesListView.Items.Add(new ListViewItem("-") { 201 Tag = optionalNullChoice, 202 Checked = multipleChoiceParameters.ContainsKey(parameter) 203 && multipleChoiceParameters[parameter].Contains(optionalNullChoice) 204 }); 205 } 206 dynamic constrainedValuedParameter = parameter; 207 dynamic validValues = constrainedValuedParameter.ValidValues; 208 foreach (var choice in validValues) { 209 choicesListView.Items.Add(new ListViewItem(choice.ToString()) { 210 Tag = choice, 211 Checked = multipleChoiceParameters.ContainsKey(parameter) 212 && multipleChoiceParameters[parameter].Contains(choice) 213 }); 208 if (isConstrainedValueParameter) { 209 if (isOptionalConstrainedValueParameter) { 210 choicesListView.Items.Add(new ListViewItem("-") { 211 Tag = optionalNullChoice, 212 Checked = multipleChoiceParameters.ContainsKey(parameter) 213 && multipleChoiceParameters[parameter].Contains(optionalNullChoice) 214 }); 215 } 216 dynamic constrainedValuedParameter = parameter; 217 dynamic validValues = constrainedValuedParameter.ValidValues; 218 foreach (var choice in validValues) { 219 choicesListView.Items.Add(new ListViewItem(choice.ToString()) { 220 Tag = choice, 221 Checked = multipleChoiceParameters.ContainsKey(parameter) 222 && multipleChoiceParameters[parameter].Contains(choice) 223 }); 224 } 225 } 226 if (isEnumValue) { 227 var enumType = parameter.Value.GetType().GetGenericArguments()[0]; 228 var enumValueType = typeof(EnumValue<>).MakeGenericType(enumType); 229 foreach (var enumChoice in Enum.GetValues(enumType)) { 230 choicesListView.Items.Add(new ListViewItem(enumChoice.ToString()) { 231 Tag = Activator.CreateInstance(enumValueType, enumChoice), 232 Checked = multipleChoiceParameters.ContainsKey(parameter) 233 && multipleChoiceParameters[parameter].Any((dynamic item) => item.Value.Equals(enumChoice)) 234 }); 235 } 214 236 } 215 237 choicesListView.Enabled = multipleChoiceParameters.ContainsKey(parameter); … … 264 286 var parameter = (IValueParameter)generateButton.Tag; 265 287 bool integerOnly = intParameters.ContainsKey(parameter); 266 d oublemin = 0, max = 1, step = 1;288 decimal min = 0, max = 1, step = 1; 267 289 #region Try to calculate some meaningful values 268 290 if (integerOnly) { … … 276 298 int len = doubleParameters[parameter].Length; 277 299 if (len > 0) { 278 min = doubleParameters[parameter].Min();279 max = doubleParameters[parameter].Max();280 step = len >= 2 ? Math.Abs(( doubleParameters[parameter][len - 1] - doubleParameters[parameter][len - 2])) : 1;300 min = (decimal)doubleParameters[parameter].Min(); 301 max = (decimal)doubleParameters[parameter].Max(); 302 step = len >= 2 ? Math.Abs(((decimal)doubleParameters[parameter][len - 1] - (decimal)doubleParameters[parameter][len - 2])) : 1m; 281 303 } 282 304 } … … 292 314 } else { 293 315 doubleParameters[parameter].Reset -= new EventHandler(ValuesArray_Reset); 294 doubleParameters[parameter] = new DoubleArray(values. ToArray());316 doubleParameters[parameter] = new DoubleArray(values.Select(x => (double)x).ToArray()); 295 317 doubleParameters[parameter].Reset += new EventHandler(ValuesArray_Reset); 296 318 stringConvertibleArrayView.Content = doubleParameters[parameter]; … … 455 477 if (valueParam != null && (valueParam.Value is ValueTypeValue<bool> 456 478 || valueParam.Value is ValueTypeValue<int> 457 || valueParam.Value is ValueTypeValue<double>) 479 || valueParam.Value is ValueTypeValue<double> 480 || (valueParam.Value != null && valueParam.Value.GetType().IsGenericType 481 && typeof(EnumValue<>).IsAssignableFrom(valueParam.Value.GetType().GetGenericTypeDefinition()))) 458 482 || typeof(OptionalConstrainedValueParameter<>).IsAssignableFrom(param.GetType().GetGenericTypeDefinition()) 459 483 || typeof(ConstrainedValueParameter<>).IsAssignableFrom(param.GetType().GetGenericTypeDefinition())) … … 603 627 bool finished; 604 628 do { 629 foreach (var p in boolParameters) { 630 if (!configuration.ContainsKey(p)) 631 configuration.Add(p, false); 632 } 633 634 yield return configuration; 605 635 finished = true; 636 606 637 foreach (var p in boolParameters) { 607 if (!configuration.ContainsKey(p)) configuration.Add(p, false); 608 else { 609 if (configuration[p]) { 610 configuration[p] = false; 611 } else { 612 configuration[p] = true; 613 finished = false; 614 break; 615 } 616 } 617 } 618 yield return configuration; 638 if (configuration[p]) { 639 configuration[p] = false; 640 } else { 641 configuration[p] = true; 642 finished = false; 643 break; 644 } 645 } 619 646 } while (!finished); 620 647 } … … 650 677 } 651 678 #endregion 679 680 #region EnumValueEqualityComparer 681 private class EnumValueEqualityComparer : EqualityComparer<IItem> { 682 public override bool Equals(IItem x, IItem y) { 683 if (typeof(EnumValue<>).IsAssignableFrom(x.GetType().GetGenericTypeDefinition()) && 684 typeof(EnumValue<>).IsAssignableFrom(y.GetType().GetGenericTypeDefinition())) { 685 dynamic enumValueX = x; 686 dynamic enumValueY = y; 687 return enumValueX.Value.Equals(enumValueY.Value); 688 } else return object.ReferenceEquals(x, y); 689 } 690 691 public override int GetHashCode(IItem obj) { 692 if (typeof(EnumValue<>).IsAssignableFrom(obj.GetType().GetGenericTypeDefinition())) { 693 dynamic enumValue = obj; 694 return enumValue.Value.GetHashCode(); 695 } else return obj.GetHashCode(); 696 } 697 } 698 #endregion 699 652 700 #endregion 653 701 … … 832 880 if (multipleChoiceParameters.Any()) { 833 881 foreach (var m in mcEnumerator.Current) { 834 dynamic variantParam = variant.Parameters[m.Key.Name]; 835 if (m.Value == optionalNullChoice) { 836 variantParam.Value = null; 837 variant.Name += m.Key.Name + "=null, "; 838 continue; 839 } 840 var variantEnumerator = ((IEnumerable<object>)variantParam.ValidValues).GetEnumerator(); 841 var originalEnumerator = ((IEnumerable<object>)((dynamic)m.Key).ValidValues).GetEnumerator(); 842 while (variantEnumerator.MoveNext() && originalEnumerator.MoveNext()) { 843 if (m.Value == (IItem)originalEnumerator.Current) { 844 variantParam.Value = (dynamic)variantEnumerator.Current; 845 if (m.Value is INamedItem) 846 variant.Name += m.Key.Name + "=" + ((INamedItem)m.Value).Name + ", "; 847 else variant.Name += m.Key.Name + "=" + m.Value.ToString() + ", "; 848 break; 882 if (m.Key.Value != null && m.Key.Value.GetType().IsGenericType 883 && typeof(EnumValue<>).IsAssignableFrom(m.Key.Value.GetType().GetGenericTypeDefinition())) { 884 var valueParam = (IValueParameter)variant.Parameters[m.Key.Name]; 885 valueParam.Value = m.Value; 886 variant.Name += m.Key.Name + "=" + m.Value + ", "; 887 } else { 888 dynamic variantParam = variant.Parameters[m.Key.Name]; 889 if (m.Value == optionalNullChoice) { 890 variantParam.Value = null; 891 variant.Name += m.Key.Name + "=null, "; 892 continue; 893 } 894 var variantEnumerator = ((IEnumerable<object>)variantParam.ValidValues).GetEnumerator(); 895 var originalEnumerator = ((IEnumerable<object>)((dynamic)m.Key).ValidValues).GetEnumerator(); 896 while (variantEnumerator.MoveNext() && originalEnumerator.MoveNext()) { 897 if (m.Value == (IItem)originalEnumerator.Current) { 898 variantParam.Value = (dynamic)variantEnumerator.Current; 899 if (m.Value is INamedItem) 900 variant.Name += m.Key.Name + "=" + ((INamedItem)m.Value).Name + ", "; 901 else variant.Name += m.Key.Name + "=" + m.Value.ToString() + ", "; 902 break; 903 } 849 904 } 850 905 }
Note: See TracChangeset
for help on using the changeset viewer.