Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/04/21 17:04:01 (3 years ago)
Author:
dpiringe
Message:

#3026

  • added the dockerhub readme file
  • fixed a bug which caused changed values (changed by events) to be overwritten with wrong values
Location:
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ConstrainedValueParameterConverter.cs

    r18043 r18077  
    1515      IParameter parameter = item as IParameter;
    1616      foreach (var x in GetValidValues(parameter))
    17         if(x.ToString() == cdata.Value)
     17        if(x.ToString() == cdata.Value && cdata.Active)
    1818          parameter.ActualValue = x;
    1919
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/EnumTypeConverter.cs

    r18057 r18077  
    1313
    1414    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
    15       ((dynamic)item).Value = (dynamic)Enum.Parse(
    16         item.GetType().GenericTypeArguments.First(),
    17         ((StringJsonItem)data).Value);
     15      if(data.Active) {
     16        ((dynamic)item).Value = (dynamic)Enum.Parse(
     17          item.GetType().GenericTypeArguments.First(),
     18          ((StringJsonItem)data).Value);
     19      }
    1820    }
    1921     
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ExperimentConverter.cs

    r18043 r18077  
    4242      if (data.Children != null) {
    4343        foreach (var i in data.Children) {
    44           if (i.Path.EndsWith("NumberOfWorkers") && i is IntJsonItem worker) {
     44          if (i.Path.EndsWith("NumberOfWorkers") && i is IntJsonItem worker && i.Active) {
    4545            experiment.NumberOfWorkers = worker.Value;
    4646          } else {
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ItemCollectionConverter.cs

    r18055 r18077  
    4040      foreach (var i in listItem.Value) {
    4141        var tmp = Instantiate(genericType);
    42         root.Inject(tmp, i, root);
    43         collection.Add((dynamic)tmp);
     42        if (data.Active) {
     43          i.Active = true;
     44          root.Inject(tmp, i, root);
     45          collection.Add((dynamic)tmp);
     46        }
    4447      }
    4548    }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/LookupParameterConverter.cs

    r18043 r18077  
    1010      t.GetInterfaces().Any(x => x == typeof(ILookupParameter));
    1111
    12     public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
    13       ((ILookupParameter)item).ActualName = ((ILookupJsonItem)data).ActualName as string;
     12    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
     13      if(data.Active)
     14        ((ILookupParameter)item).ActualName = ((ILookupJsonItem)data).ActualName as string;
     15    }
     16     
    1417
    1518    public override IJsonItem Extract(IItem value, IJsonItemConverter root) {
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/MultiCheckedOperatorConverter.cs

    r18043 r18077  
    1717        IJsonItem childItem = GetChildItem(op.Name, data);
    1818        if(childItem != null) {
    19           if(childItem is BoolJsonItem boolJsonItem) {
     19          if(childItem is BoolJsonItem boolJsonItem && childItem.Active) {
    2020            val.Operators.SetItemCheckedState(op, boolJsonItem.Value);
    2121          }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/RegressionProblemDataConverter.cs

    r18057 r18077  
    2222
    2323    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
     24      if (data.Children.All(x => !x.Active))
     25        return;
     26
    2427      var parameter = item as ValueParameter<IRegressionProblemData>;
    2528
    26       DoubleMatrixJsonItem dataset = null;
    27       StringJsonItem targetVariable = null;
    28       IntRangeJsonItem testPartition = null;
    29       IntRangeJsonItem trainingPartition = null;
    30       StringArrayJsonItem allowedInputVariables = null;
     29      DoubleMatrixJsonItem datasetItem = null;
     30      StringJsonItem targetVariableItem = null;
     31      IntRangeJsonItem testPartitionItem = null;
     32      IntRangeJsonItem trainingPartitionItem = null;
     33      StringArrayJsonItem allowedInputVariablesItem = null;
    3134
    3235      // get all child items
    3336      foreach (var child in data.Children) {
     37        if (!child.Active)
     38          continue;
     39
    3440        if (child.Path.EndsWith(Dataset))
    35           dataset = child as DoubleMatrixJsonItem;
     41          datasetItem = child as DoubleMatrixJsonItem;
    3642        else if (child.Path.EndsWith(TargetVariable))
    37           targetVariable = child as StringJsonItem;
     43          targetVariableItem = child as StringJsonItem;
    3844        else if (child.Path.EndsWith(TestPartition))
    39           testPartition = child as IntRangeJsonItem;
     45          testPartitionItem = child as IntRangeJsonItem;
    4046        else if (child.Path.EndsWith(TrainingPartition))
    41           trainingPartition = child as IntRangeJsonItem;
     47          trainingPartitionItem = child as IntRangeJsonItem;
    4248        else if (child.Path.EndsWith(AllowedInputVariables))
    43           allowedInputVariables = child as StringArrayJsonItem;
     49          allowedInputVariablesItem = child as StringArrayJsonItem;
    4450      }
    4551
    4652      // check data
    47       if(!dataset.ColumnNames.Any(x => x == targetVariable.Value)) {
    48         throw new Exception($"The value of the target variable ('{targetVariable.Value}') has no matching row name value of the dataset.");
     53      if(!datasetItem.ColumnNames.Any(x => x == targetVariableItem.Value)) {
     54        throw new Exception($"The value of the target variable ('{targetVariableItem.Value}') has no matching row name value of the dataset.");
    4955      }
    5056
    51       foreach(var v in allowedInputVariables.Value) {
    52         if(!dataset.ColumnNames.Any(x => x == v))
     57      foreach(var v in allowedInputVariablesItem.Value) {
     58        if(!datasetItem.ColumnNames.Any(x => x == v))
    5359          throw new Exception($"The value of the input variable ('{v}') has no matching row name value of the dataset.");
    5460      }
    5561
    5662      // create the new problemData object
     63      var dataset = datasetItem == null ?
     64        parameter.Value.Dataset :
     65        new Dataset(datasetItem.ColumnNames, datasetItem.Value);
     66
     67      var allowedInputVariables = allowedInputVariablesItem == null ?
     68        parameter.Value.AllowedInputVariables :
     69        allowedInputVariablesItem.Value;
     70
     71      var targetVariable = targetVariableItem == null ?
     72        parameter.Value.TargetVariable :
     73        targetVariableItem.Value;
     74
    5775      var problemData = new RegressionProblemData(
    58         new Dataset(dataset.ColumnNames, dataset.Value),
    59         allowedInputVariables.Value,
    60         targetVariable.Value);
     76        dataset,
     77        allowedInputVariables,
     78        targetVariable);
    6179
    6280      // set the new problemData
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/StringValueConverter.cs

    r18043 r18077  
    1010      typeof(StringValue).IsAssignableFrom(t);
    1111
    12     public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
    13       ((StringValue)item).Value = ((StringJsonItem)data).Value;
     12    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
     13      if(data.Active)
     14        ((StringValue)item).Value = ((StringJsonItem)data).Value;
     15    }
     16     
    1417
    1518    public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueLookupParameterConverter.cs

    r18045 r18077  
    1313      IValueLookupParameter param = item as IValueLookupParameter;
    1414      IValueLookupJsonItem lookupItem = data as IValueLookupJsonItem;
    15       param.ActualName = lookupItem.ActualName;
     15      if(data.Active)
     16        param.ActualName = lookupItem.ActualName;
    1617      if (param.Value != null && lookupItem.ActualValue != null)
    1718        root.Inject(param.Value, lookupItem.ActualValue, root);
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueParameterConverter.cs

    r18045 r18077  
    1313      IParameter parameter = value as IParameter;
    1414
    15       if (parameter.ActualValue == null)
     15      if (parameter.ActualValue == null && data.Active)
    1616        parameter.ActualValue = Instantiate(parameter.DataType);
    1717      root.Inject(parameter.ActualValue, data, root);
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueRangeConverter.cs

    r17843 r18077  
    1414      IntRange range = item as IntRange;
    1515      IntRangeJsonItem cdata = data as IntRangeJsonItem;
    16       range.Start = cdata.MinValue;
    17       range.End = cdata.MaxValue;
     16      if(data.Active) {
     17        range.Start = cdata.MinValue;
     18        range.End = cdata.MaxValue;
     19      }
    1820    }
    1921
     
    4042      DoubleRange range = item as DoubleRange;
    4143      DoubleRangeJsonItem cdata = data as DoubleRangeJsonItem;
    42       range.Start = cdata.MinValue;
    43       range.End = cdata.MaxValue;
     44      if (data.Active) {
     45        range.Start = cdata.MinValue;
     46        range.End = cdata.MaxValue;
     47      }
    4448    }
    4549
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeArrayConverter.cs

    r18043 r18077  
    1212
    1313    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
    14       IntArray arr = item as IntArray;
    15       IntArrayJsonItem intArrayItem = data as IntArrayJsonItem;
    16       bool resizeTmp = arr.Resizable;
    17       arr.Resizable = true;
    18       arr.Length = intArrayItem.Value.Length;
    19       for (int i = 0; i < intArrayItem.Value.Length; ++i)
    20         arr[i] = intArrayItem.Value[i];
    21       arr.Resizable = resizeTmp;
     14      if(data.Active) {
     15        IntArray arr = item as IntArray;
     16        IntArrayJsonItem intArrayItem = data as IntArrayJsonItem;
     17        bool resizeTmp = arr.Resizable;
     18        arr.Resizable = true;
     19        arr.Length = intArrayItem.Value.Length;
     20        for (int i = 0; i < intArrayItem.Value.Length; ++i)
     21          arr[i] = intArrayItem.Value[i];
     22        arr.Resizable = resizeTmp;
     23      }
    2224    }
    2325
     
    3941
    4042    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
    41       DoubleArray arr = item as DoubleArray;
    42       DoubleArrayJsonItem doubleArrayItem = data as DoubleArrayJsonItem;
    43       bool resizeTmp = arr.Resizable;
    44       arr.Resizable = true;
    45       arr.Length = doubleArrayItem.Value.Length;
    46       for (int i = 0; i < doubleArrayItem.Value.Length; ++i)
    47         arr[i] = doubleArrayItem.Value[i];
    48       arr.Resizable = resizeTmp;
     43      if(data.Active) {
     44        DoubleArray arr = item as DoubleArray;
     45        DoubleArrayJsonItem doubleArrayItem = data as DoubleArrayJsonItem;
     46        bool resizeTmp = arr.Resizable;
     47        arr.Resizable = true;
     48        arr.Length = doubleArrayItem.Value.Length;
     49        for (int i = 0; i < doubleArrayItem.Value.Length; ++i)
     50          arr[i] = doubleArrayItem.Value[i];
     51        arr.Resizable = resizeTmp;
     52      }
    4953    }
    5054
     
    6670
    6771    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
    68       PercentArray arr = item as PercentArray;
    69       DoubleArrayJsonItem doubleArrayItem = data as DoubleArrayJsonItem;
    70       bool resizeTmp = arr.Resizable;
    71       arr.Resizable = true;
    72       arr.Length = doubleArrayItem.Value.Length;
    73       for (int i = 0; i < doubleArrayItem.Value.Length; ++i)
    74         arr[i] = doubleArrayItem.Value[i];
    75       arr.Resizable = resizeTmp;
     72      if(data.Active) {
     73        PercentArray arr = item as PercentArray;
     74        DoubleArrayJsonItem doubleArrayItem = data as DoubleArrayJsonItem;
     75        bool resizeTmp = arr.Resizable;
     76        arr.Resizable = true;
     77        arr.Length = doubleArrayItem.Value.Length;
     78        for (int i = 0; i < doubleArrayItem.Value.Length; ++i)
     79          arr[i] = doubleArrayItem.Value[i];
     80        arr.Resizable = resizeTmp;
     81      }
    7682    }
    7783
     
    9399
    94100    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
    95       BoolArray arr = item as BoolArray;
    96       BoolArrayJsonItem boolArrayItem = data as BoolArrayJsonItem;
    97       bool resizeTmp = arr.Resizable;
    98       arr.Resizable = true;
    99       arr.Length = boolArrayItem.Value.Length;
    100       for(int i = 0; i < boolArrayItem.Value.Length; ++i)
    101         arr[i] = boolArrayItem.Value[i];
    102       arr.Resizable = resizeTmp;
     101      if(data.Active) {
     102        BoolArray arr = item as BoolArray;
     103        BoolArrayJsonItem boolArrayItem = data as BoolArrayJsonItem;
     104        bool resizeTmp = arr.Resizable;
     105        arr.Resizable = true;
     106        arr.Length = boolArrayItem.Value.Length;
     107        for (int i = 0; i < boolArrayItem.Value.Length; ++i)
     108          arr[i] = boolArrayItem.Value[i];
     109        arr.Resizable = resizeTmp;
     110      }
    103111    }
    104112
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeMatrixConverter.cs

    r18043 r18077  
    99
    1010    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
    11       IntMatrix mat = item as IntMatrix;
    12       IntMatrixJsonItem d = data as IntMatrixJsonItem;
    13       CopyMatrixData(mat, d.Value);
     11      if(data.Active) {
     12        IntMatrix mat = item as IntMatrix;
     13        IntMatrixJsonItem d = data as IntMatrixJsonItem;
     14        CopyMatrixData(mat, d.Value);
     15      }
    1416    }
    1517
     
    2830
    2931    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
    30       DoubleMatrix mat = item as DoubleMatrix;
    31       DoubleMatrixJsonItem d = data as DoubleMatrixJsonItem;
    32       CopyMatrixData(mat, d.Value);
     32      if(data.Active) {
     33        DoubleMatrix mat = item as DoubleMatrix;
     34        DoubleMatrixJsonItem d = data as DoubleMatrixJsonItem;
     35        CopyMatrixData(mat, d.Value);
     36      }
    3337    }
    3438
     
    4953
    5054    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
    51       PercentMatrix mat = item as PercentMatrix;
    52       DoubleMatrixJsonItem d = data as DoubleMatrixJsonItem;
    53       CopyMatrixData(mat, d.Value);
     55      if(data.Active) {
     56        PercentMatrix mat = item as PercentMatrix;
     57        DoubleMatrixJsonItem d = data as DoubleMatrixJsonItem;
     58        CopyMatrixData(mat, d.Value);
     59      }
    5460    }
    5561
     
    6874
    6975    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
    70       BoolMatrix mat = item as BoolMatrix;
    71       BoolMatrixJsonItem d = data as BoolMatrixJsonItem;
    72       CopyMatrixData(mat, d.Value);
     76      if(data.Active) {
     77        BoolMatrix mat = item as BoolMatrix;
     78        BoolMatrixJsonItem d = data as BoolMatrixJsonItem;
     79        CopyMatrixData(mat, d.Value);
     80      }
    7381    }
    7482
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeValueConverter.cs

    r17843 r18077  
    1111      typeof(IntValue).IsAssignableFrom(t);
    1212
    13     public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
    14       ((IntValue)item).Value = ((IntJsonItem)data).Value;
     13    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
     14      if(data.Active)
     15        ((IntValue)item).Value = ((IntJsonItem)data).Value;
     16    }
     17     
    1518
    1619    public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
     
    3033      typeof(DoubleValue).IsAssignableFrom(t);
    3134
    32     public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
    33       ((DoubleValue)item).Value = ((DoubleJsonItem)data).Value;
     35    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
     36      if (data.Active)
     37        ((DoubleValue)item).Value = ((DoubleJsonItem)data).Value;
     38    }
    3439
    3540    public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
     
    4954      typeof(PercentValue).IsAssignableFrom(t);
    5055
    51     public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
    52       ((PercentValue)item).Value = ((DoubleJsonItem)data).Value;
     56    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
     57      if (data.Active)
     58        ((PercentValue)item).Value = ((DoubleJsonItem)data).Value;
     59    }
    5360
    5461    public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
     
    6875      typeof(BoolValue).IsAssignableFrom(t);
    6976
    70     public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
    71       ((BoolValue)item).Value = ((BoolJsonItem)data).Value;
     77    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
     78      if (data.Active)
     79        ((BoolValue)item).Value = ((BoolJsonItem)data).Value;
     80    }
    7281
    7382    public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
     
    8594      typeof(DateTimeValue).IsAssignableFrom(t);
    8695
    87     public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
    88       ((DateTimeValue)item).Value = ((DateTimeJsonItem)data).Value;
     96    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) {
     97      if (data.Active)
     98        ((DateTimeValue)item).Value = ((DateTimeJsonItem)data).Value;
     99    }
    89100
    90101    public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
Note: See TracChangeset for help on using the changeset viewer.