Changeset 14079
- Timestamp:
- 07/15/16 10:20:58 (8 years ago)
- Location:
- branches/crossvalidation-2434
- Files:
-
- 4 deleted
- 14 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/crossvalidation-2434
- Property svn:mergeinfo changed
/trunk/sources merged: 14032,14034,14036-14037,14056-14057,14071,14078
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Common/3.3/ObjectExtensions.cs
r14029 r14079 30 30 31 31 namespace HeuristicLab.Common { 32 33 [AttributeUsage(System.AttributeTargets.Field)] 34 // this attribute can be used to mark fields that should be excluded from object graph traversal 35 public class ExcludeFromObjectGraphTraversalAttribute : Attribute { 36 } 37 32 38 public static class ObjectExtensions { 33 39 public static IEnumerable<T> ToEnumerable<T>(this T obj) { … … 63 69 /// * System.Delegate 64 70 /// * System.Reflection.Pointer 65 /// * System.RuntimeType66 71 /// * Primitives (Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Char, Double, Single) 67 72 /// * string, decimal, DateTime … … 80 85 typeof(Pointer).IsAssignableFrom(type) || 81 86 type.Namespace == "System.Reflection.Emit" || 82 type.Assembly.GetName().Name == "System.Runtime.Serialization" ||83 typeof(TypeInfo).IsAssignableFrom(type) ||84 87 (type.HasElementType && ExcludeType(type.GetElementType())); 85 88 } … … 117 120 } else { 118 121 if (!fieldInfos.ContainsKey(type)) 119 fieldInfos[type] = type.GetAllFields().ToArray(); 122 fieldInfos[type] = type.GetAllFields() 123 .Where(fi => !fi.GetCustomAttributes<ExcludeFromObjectGraphTraversalAttribute>().Any()) 124 .ToArray(); 120 125 foreach (FieldInfo f in fieldInfos[type]) { 121 126 if (excludeStaticMembers && f.IsStatic) continue; -
branches/crossvalidation-2434/HeuristicLab.Data/3.3
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Data/3.3 merged: 14034
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Data/3.3/TimeSpanValue.cs
r14029 r14079 65 65 } 66 66 protected virtual string GetValue() { 67 return Value.ToString( );67 return Value.ToString("c"); 68 68 } 69 69 protected virtual bool SetValue(string value) { … … 75 75 return false; 76 76 } 77 } 78 public override string ToString() { 79 return Value.ToString("c"); 77 80 } 78 81 -
branches/crossvalidation-2434/HeuristicLab.Optimization
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Optimization merged: 14071
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Optimization.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Optimization.Views merged: 14071
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj
r14029 r14079 166 166 <DependentUpon>ExperimentListView.cs</DependentUpon> 167 167 </Compile> 168 <Compile Include="ResultParameterView.cs"> 169 <SubType>UserControl</SubType> 170 </Compile> 171 <Compile Include="ResultParameterView.Designer.cs"> 172 <DependentUpon>ResultParameterView.cs</DependentUpon> 173 </Compile> 168 174 <Compile Include="MultiEncodingView.cs"> 169 175 <SubType>UserControl</SubType> … … 405 411 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> 406 412 <Name>HeuristicLab.Optimization-3.3</Name> 413 <Private>False</Private> 414 </ProjectReference> 415 <ProjectReference Include="..\..\HeuristicLab.Parameters.Views\3.3\HeuristicLab.Parameters.Views-3.3.csproj"> 416 <Project>{ae5b1ce5-9862-4d6f-a700-d72cd9aea295}</Project> 417 <Name>HeuristicLab.Parameters.Views-3.3</Name> 418 <Private>False</Private> 419 </ProjectReference> 420 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 421 <Project>{56f9106a-079f-4c61-92f6-86a84c2d84b7}</Project> 422 <Name>HeuristicLab.Parameters-3.3</Name> 407 423 <Private>False</Private> 408 424 </ProjectReference> -
branches/crossvalidation-2434/HeuristicLab.Optimization.Views/3.3/Plugin.cs.frame
r14029 r14079 39 39 [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")] 40 40 [PluginDependency("HeuristicLab.Optimization", "3.3")] 41 [PluginDependency("HeuristicLab.Parameters.Views", "3.3")] 41 42 [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] 42 43 [PluginDependency("HeuristicLab.Problems.Instances.Views", "3.3")] -
branches/crossvalidation-2434/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r14029 r14079 156 156 <Compile Include="Interfaces\ILocalImprovementAlgorithmOperator.cs" /> 157 157 <Compile Include="Interfaces\IMultiObjectiveOperator.cs" /> 158 <Compile Include="Results\IResultParameter.cs" /> 158 159 <Compile Include="Interfaces\ISingleObjectiveOperator.cs" /> 159 160 <Compile Include="Interfaces\ISingleObjectivePathRelinker.cs" /> … … 169 170 <Compile Include="MetaOptimizers\Experiment.cs" /> 170 171 <Compile Include="MetaOptimizers\TimeLimitRun.cs" /> 172 <Compile Include="Results\ResultParameter.cs" /> 171 173 <Compile Include="RunCollectionModification\RunCollectionRunRemover.cs" /> 172 174 <Compile Include="Plugin.cs" /> … … 230 232 <Compile Include="RunCollection.cs" /> 231 233 <Compile Include="Run.cs" /> 232 <Compile Include=" Interfaces\IResult.cs" />234 <Compile Include="Results\IResult.cs" /> 233 235 <Compile Include="Interfaces\IDiscreteDoubleValueModifier.cs" /> 234 236 <Compile Include="Interfaces\IExhaustiveMoveGenerator.cs" /> … … 254 256 <Compile Include="Interfaces\ITabuChecker.cs" /> 255 257 <Compile Include="Interfaces\ITabuMaker.cs" /> 256 <Compile Include="Result .cs" />258 <Compile Include="Results\Result.cs" /> 257 259 <Compile Include="Algorithms\UserDefinedAlgorithm.cs" /> 258 260 <Compile Include="Algorithms\EngineAlgorithm.cs" /> 259 261 <Compile Include="Properties\AssemblyInfo.cs" /> 260 <Compile Include="Result Collection.cs" />262 <Compile Include="Results\ResultCollection.cs" /> 261 263 <Compile Include="Problems\UserDefinedProblem.cs" /> 262 264 </ItemGroup> -
branches/crossvalidation-2434/HeuristicLab.Parameters.Views/3.3/HeuristicLab.Parameters.Views-3.3.csproj
r11623 r14079 217 217 <Private>False</Private> 218 218 </ProjectReference> 219 <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj">220 <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project>221 <Name>HeuristicLab.Optimization.Views-3.3</Name>222 <Private>False</Private>223 </ProjectReference>224 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">225 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>226 <Name>HeuristicLab.Optimization-3.3</Name>227 <Private>False</Private>228 </ProjectReference>229 219 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 230 220 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> -
branches/crossvalidation-2434/HeuristicLab.Parameters/3.3/LookupParameter.cs
r12012 r14079 50 50 public string TranslatedName { 51 51 get { 52 string translatedName ;53 GetValueParameterAndTranslateName( outtranslatedName);52 string translatedName = Name; 53 GetValueParameterAndTranslateName(ExecutionContext, ref translatedName); 54 54 return translatedName; 55 55 } … … 61 61 62 62 private Lazy<ThreadLocal<IItem>> cachedActualValues; 63 pr ivateIItem CachedActualValue {63 protected IItem CachedActualValue { 64 64 get { return cachedActualValues.Value.Value; } 65 set { cachedActualValues.Value.Value = value; } 65 66 } 66 67 … … 128 129 } 129 130 130 pr ivate IValueParameter GetValueParameterAndTranslateName(out string actualName) {131 protected static IValueParameter GetValueParameterAndTranslateName(IExecutionContext executionContext, ref string translatedName) { 131 132 IValueParameter valueParam; 132 133 ILookupParameter lookupParam; 133 IExecutionContext currentExecutionContext = ExecutionContext; 134 135 actualName = Name; 134 IExecutionContext currentExecutionContext = executionContext; 135 136 136 while (currentExecutionContext != null) { 137 valueParam = currentExecutionContext.Parameters[actualName] as IValueParameter; 138 lookupParam = currentExecutionContext.Parameters[actualName] as ILookupParameter; 137 IParameter param = null; 138 while (currentExecutionContext != null && !currentExecutionContext.Parameters.TryGetValue(translatedName, out param)) 139 currentExecutionContext = currentExecutionContext.Parent; 140 if (currentExecutionContext == null) break; 141 142 valueParam = param as IValueParameter; 143 lookupParam = param as ILookupParameter; 139 144 140 145 if ((valueParam == null) && (lookupParam == null)) 141 146 throw new InvalidOperationException( 142 147 string.Format("Parameter look-up chain broken. Parameter \"{0}\" is not an \"{1}\" or an \"{2}\".", 143 actualName, typeof(IValueParameter).GetPrettyName(), typeof(ILookupParameter).GetPrettyName())148 translatedName, typeof(IValueParameter).GetPrettyName(), typeof(ILookupParameter).GetPrettyName()) 144 149 ); 145 150 … … 148 153 else if (lookupParam == null) return valueParam; 149 154 } 150 if (lookupParam != null) actualName = lookupParam.ActualName;155 translatedName = lookupParam.ActualName; 151 156 152 157 currentExecutionContext = currentExecutionContext.Parent; 153 while ((currentExecutionContext != null) && !currentExecutionContext.Parameters.ContainsKey(actualName))154 currentExecutionContext = currentExecutionContext.Parent;155 158 } 156 159 return null; 157 160 } 158 pr ivate IVariable LookupVariable(string name) {159 I Scope scope = ExecutionContext.Scope;160 while ( (scope != null) && !scope.Variables.ContainsKey(name))161 protected static IVariable LookupVariable(IScope scope, string name) { 162 IVariable variable = null; 163 while (scope != null && !scope.Variables.TryGetValue(name, out variable)) 161 164 scope = scope.Parent; 162 return scope != null ? scope.Variables[name] : null; 163 } 165 return scope != null ? variable : null; 166 } 167 164 168 protected override IItem GetActualValue() { 165 169 if (CachedActualValue != null) return CachedActualValue; 166 string name; 170 171 string translatedName = Name; 172 var value = GetValue(ExecutionContext, ref translatedName); 173 if (value != null && !(value is T)) 174 throw new InvalidOperationException( 175 string.Format("Type mismatch. Variable \"{0}\" does not contain a \"{1}\".", 176 translatedName, 177 typeof(T).GetPrettyName()) 178 ); 179 CachedActualValue = value; 180 return value; 181 } 182 183 protected static IItem GetValue(IExecutionContext executionContext, ref string name) { 167 184 // try to get value from context stack 168 IValueParameter param = GetValueParameterAndTranslateName( outname);185 IValueParameter param = GetValueParameterAndTranslateName(executionContext, ref name); 169 186 if (param != null) return param.Value; 170 187 171 188 // try to get variable from scope 172 IVariable var = LookupVariable(name); 173 if (var != null) { 174 if (!(var.Value is T)) 175 throw new InvalidOperationException( 176 string.Format("Type mismatch. Variable \"{0}\" does not contain a \"{1}\".", 177 name, 178 typeof(T).GetPrettyName()) 179 ); 180 cachedActualValues.Value.Value = var.Value; 181 return var.Value; 182 } 183 return null; 184 } 189 IVariable var = LookupVariable(executionContext.Scope, name); 190 return var != null ? var.Value : null; 191 } 192 185 193 protected override void SetActualValue(IItem value) { 186 194 if (!(value is T)) … … 189 197 typeof(T).GetPrettyName()) 190 198 ); 191 cachedActualValues.Value.Value = value; 192 199 CachedActualValue = value; 200 201 string translatedName = Name; 202 SetValue(ExecutionContext, ref translatedName, value); 203 } 204 205 protected static void SetValue(IExecutionContext executionContext, ref string name, IItem value) { 193 206 // try to set value in context stack 194 string name; 195 IValueParameter param = GetValueParameterAndTranslateName(out name); 207 IValueParameter param = GetValueParameterAndTranslateName(executionContext, ref name); 196 208 if (param != null) { 197 209 param.Value = value; … … 200 212 201 213 // try to set value in scope 202 IVariable var = LookupVariable( name);214 IVariable var = LookupVariable(executionContext.Scope, name); 203 215 if (var != null) { 204 216 var.Value = value; … … 207 219 208 220 // create new variable 209 ExecutionContext.Scope.Variables.Add(new Variable(name, value));221 executionContext.Scope.Variables.Add(new Variable(name, value)); 210 222 } 211 223 -
branches/crossvalidation-2434/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression merged: 14036
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 merged: 14036
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
r14029 r14079 332 332 terms.Add(t); 333 333 } 334 term = AutoDiff.TermBuilder.Sum(terms); 334 if (terms.Count == 1) term = -terms[0]; 335 else term = AutoDiff.TermBuilder.Sum(terms); 335 336 return true; 336 337 }
Note: See TracChangeset
for help on using the changeset viewer.