Changeset 16699


Ignore:
Timestamp:
03/20/19 09:41:45 (3 months ago)
Author:
gkronber
Message:

#2971: fixed a bug which caused an exception when loading problem instances with string variables (e.g. Miba instances)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs

    r16644 r16699  
    9494      problemData.Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly()));
    9595      problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>()));
    96       problemData.Parameters.Add(new FixedValueParameter<NamedIntervals>(VariableRangesParameterName,"", new NamedIntervals()));
     96      problemData.Parameters.Add(new FixedValueParameter<NamedIntervals>(VariableRangesParameterName, "", new NamedIntervals()));
    9797      problemData.Parameters.Add(new FixedValueParameter<TextValue>(IntervalConstraintsParameterName, "", new TextValue()));
    9898      emptyProblemData = problemData;
     
    108108    public NamedIntervals VariableRanges => VariableRangesParameter.Value;
    109109
    110     public IFixedValueParameter<TextValue> IntervalConstraintsParameter => (IFixedValueParameter<TextValue>) Parameters[IntervalConstraintsParameterName];
     110    public IFixedValueParameter<TextValue> IntervalConstraintsParameter => (IFixedValueParameter<TextValue>)Parameters[IntervalConstraintsParameterName];
    111111    public TextValue IntervalConstraints => IntervalConstraintsParameter.Value;
    112112
     
    168168      NamedIntervals namedIntervals = new NamedIntervals();
    169169      foreach (var variable in variables) {
    170         var variableInteval = Interval.GetInterval(dataset.GetDoubleValues(variable.Value));
    171         namedIntervals.Add(variable.Value, variableInteval);
     170        if (!dataset.DoubleVariables.Contains(variable.Value)) continue; // intervals are only possible for double variables
     171        var variableInterval = Interval.GetInterval(dataset.GetDoubleValues(variable.Value));
     172        namedIntervals.Add(variable.Value, variableInterval);
    172173      }
    173174
Note: See TracChangeset for help on using the changeset viewer.