- Timestamp:
- 02/12/21 15:24:18 (4 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface
- Files:
-
- 6 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/AlgorithmConverter.cs
r17828 r17834 30 30 IAlgorithm algorithm = value as IAlgorithm; 31 31 foreach (var res in algorithm.Results) { 32 item.AddChildren(root.Extract(res, root)); 33 /* 32 34 item.AddChildren(new ResultJsonItem() { 33 35 Name = res.Name, 34 36 Description = res.Description 35 }); 37 });*/ 36 38 } 37 39 item.AddChildren(root.Extract(algorithm.Problem, root)); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/BaseConverter.cs
r17828 r17834 20 20 public abstract IJsonItem Extract(IItem value, IJsonItemConverter root); 21 21 22 22 23 #region Helper 23 24 24 protected IItem Instantiate(Type type, params object[] args) => 25 25 (IItem)Activator.CreateInstance(type,args); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/RegressionProblemDataConverter.cs
r17828 r17834 66 66 67 67 // check data 68 if(!dataset. RowNames.Any(x => x == targetVariable.Value)) {68 if(!dataset.ColumnNames.Any(x => x == targetVariable.Value)) { 69 69 throw new Exception($"The value of the target variable ('{targetVariable.Value}') has no matching row name value of the dataset."); 70 70 } 71 71 72 72 foreach(var v in allowedInputVariables.Value) { 73 if(!dataset. RowNames.Any(x => x == v))73 if(!dataset.ColumnNames.Any(x => x == v)) 74 74 throw new Exception($"The value of the input variable ('{v}') has no matching row name value of the dataset."); 75 75 } … … 106 106 var dictTmp = new Dictionary<string, IList>(); 107 107 int c = 0; 108 foreach (var col in item. RowNames) {108 foreach (var col in item.ColumnNames) { 109 109 dictTmp.Add(col, new List<double>(item.Value[c])); 110 110 ++c; … … 116 116 117 117 var variableNames = dataset.GetType().GetField(VariableNames, flags); 118 variableNames.SetValue(dataset, item. RowNames);118 variableNames.SetValue(dataset, item.ColumnNames); 119 119 120 120 var dataInfo = dataset.GetType().GetField(VariableValues, flags); … … 162 162 163 163 // add list items and set their check state (based on allowed input variables) 164 foreach(var i in matrix. RowNames) {164 foreach(var i in matrix.ColumnNames) { 165 165 bool isChecked = false; 166 166 foreach(var x in item.Value) -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ResultParameterConverter.cs
r17828 r17834 1 1 using System; 2 using System.Collections.Generic;3 2 using System.Linq; 4 using System.Text;5 using System.Threading.Tasks;6 3 using HeuristicLab.Core; 7 4 using HeuristicLab.Optimization; … … 14 11 15 12 public override bool CanConvertType(Type t) => 16 t.GetInterfaces().Any(x => x == typeof(IResultParameter));13 t.GetInterfaces().Any(x => x == ConvertableType); 17 14 18 15 public override IJsonItem Extract(IItem value, IJsonItemConverter root) { 19 16 IResultParameter res = value as IResultParameter; 17 var formatter = ResultFormatter.ForType(res.DataType).Last(); 20 18 return new ResultJsonItem() { 21 19 Name = res.ActualName, 22 Description = res.Description 20 Description = res.Description, 21 ResultFormatterType = formatter.GetType().FullName, 22 ValueType = res.DataType 23 23 }; 24 24 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj
r17829 r17834 66 66 <Compile Include="Converters\ExperimentConverter.cs" /> 67 67 <Compile Include="Converters\RegressionProblemDataConverter.cs" /> 68 <Compile Include="Converters\ResultConverter.cs" /> 68 69 <Compile Include="Converters\ResultParameterConverter.cs" /> 70 <Compile Include="Converters\SymbolicRegressionSolutionConverter.cs" /> 69 71 <Compile Include="Converters\ValueLookupParameterConverter.cs" /> 70 72 <Compile Include="Converters\ValueRangeConverter.cs" /> … … 77 79 <Compile Include="Interfaces\IMatrixJsonItem.cs" /> 78 80 <Compile Include="Interfaces\IRangedJsonItem.cs" /> 81 <Compile Include="Interfaces\IResultFormatter.cs" /> 79 82 <Compile Include="Interfaces\IResultJsonItem.cs" /> 80 83 <Compile Include="Interfaces\IValueJsonItem.cs" /> … … 100 103 <Compile Include="JsonItems\ValueJsonItem.cs" /> 101 104 <Compile Include="JsonItems\ValueLookupJsonItem.cs" /> 105 <Compile Include="ResultFormatter\MatlabResultFormatter.cs" /> 106 <Compile Include="ResultFormatter\ResultFormatter.cs" /> 107 <Compile Include="ResultFormatter\StringResultFormatter.cs" /> 102 108 <Compile Include="SingleLineArrayJsonWriter.cs" /> 103 109 <Compile Include="JsonTemplateGenerator.cs" /> … … 142 148 <Name>HeuristicLab.Data-3.3</Name> 143 149 </ProjectReference> 150 <ProjectReference Include="..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj"> 151 <Project>{06d4a186-9319-48a0-bade-a2058d462eea}</Project> 152 <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name> 153 </ProjectReference> 144 154 <ProjectReference Include="..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 145 155 <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project> … … 153 163 <Project>{94186a6a-5176-4402-ae83-886557b53cca}</Project> 154 164 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 165 </ProjectReference> 166 <ProjectReference Include="..\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj"> 167 <Project>{5ac82412-911b-4fa2-a013-edc5e3f3fcc2}</Project> 168 <Name>HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4</Name> 169 </ProjectReference> 170 <ProjectReference Include="..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj"> 171 <Project>{3d28463f-ec96-4d82-afee-38be91a0ca00}</Project> 172 <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name> 155 173 </ProjectReference> 156 174 <ProjectReference Include="..\HeuristicLab.Problems.DataAnalysis\3.4\HeuristicLab.Problems.DataAnalysis-3.4.csproj"> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Interfaces/IResultJsonItem.cs
r17519 r17834 1 namespace HeuristicLab.JsonInterface { 1 using System; 2 using Newtonsoft.Json; 3 4 namespace HeuristicLab.JsonInterface { 2 5 /// <summary> 3 /// EmptyJsonItem, which indicates a result. For example 'BestQuality'.6 /// JsonItem, which indicates a result. For example 'BestQuality'. 4 7 /// Types of this JsonItems are stored in the result section of the template. 5 8 /// </summary> 6 public interface IResultJsonItem : IJsonItem { } 9 public interface IResultJsonItem : IJsonItem { 10 /// <summary> 11 /// the result formatter type's fullname 12 /// </summary> 13 string ResultFormatterType { get; set; } 14 15 /// <summary> 16 /// the type of the result value 17 /// </summary> 18 [JsonIgnore] 19 Type ValueType { get; set; } 20 } 7 21 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItems/JsonItem.cs
r17828 r17834 125 125 }); 126 126 127 public virtual void SetJObject(JObject jObject) { } 127 public virtual void SetJObject(JObject jObject) { 128 Name = (jObject[nameof(IJsonItem.Name)]?.ToObject<string>()); 129 Description = (jObject[nameof(IJsonItem.Description)]?.ToObject<string>()); 130 } 128 131 #endregion 129 132 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItems/ResultJsonItem.cs
r17828 r17834 1 namespace HeuristicLab.JsonInterface { 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using Newtonsoft.Json.Linq; 5 6 namespace HeuristicLab.JsonInterface { 2 7 public class ResultJsonItem : JsonItem, IResultJsonItem { 8 public string ResultFormatterType { get; set; } 9 10 public Type ValueType { get; set; } 11 3 12 protected override ValidationResult Validate() => ValidationResult.Successful(); 4 13 5 public string Converter { get; set; } 14 public override void SetJObject(JObject jObject) { 15 base.SetJObject(jObject); 16 ResultFormatterType = (jObject[nameof(IResultJsonItem.ResultFormatterType)]?.ToObject<string>()); 17 } 18 6 19 } 7 20 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateInstantiator.cs
r17828 r17834 81 81 IList<IResultJsonItem> res = new List<IResultJsonItem>(); 82 82 foreach(JObject obj in Template[Constants.Results]) { 83 string name = obj.Property("Name").Value.ToString(); 84 res.Add(new ResultJsonItem() { Name = name }); 83 //string name = obj.Property("Name").Value.ToString(); 84 var resultItem = new ResultJsonItem(); 85 resultItem.SetJObject(obj); 86 res.Add(resultItem); 87 //res.Add(new ResultJsonItem() { Name = name }); 85 88 } 86 89 return res; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Plugin.cs.frame
r17330 r17834 34 34 [PluginDependency("HeuristicLab.Parameters", "3.3")] 35 35 [PluginDependency("HeuristicLab.SequentialEngine", "3.3")] 36 [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")] 37 [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")] 38 [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")] 39 [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression", "3.4")] 40 [PluginDependency("HeuristicLab.Problems.Instances.DataAnalysis", "3.3")] 36 41 public class HeuristicLabJsonInterfacePlugin : PluginBase { 37 42 }
Note: See TracChangeset
for help on using the changeset viewer.