- Timestamp:
- 05/07/19 09:16:04 (6 years ago)
- Location:
- branches/2931_OR-Tools_LP_MIP
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2931_OR-Tools_LP_MIP
- Property svn:mergeinfo changed
/trunk merged: 16819-16822,16839,16853,16855-16856,16858,16860-16861,16867-16869,16872-16873,16875,16878,16890,16894
- Property svn:mergeinfo changed
-
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Problems.DataAnalysis.Symbolic merged: 16822,16839,16858,16868
- Property svn:mergeinfo changed
-
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/LinearModelToTreeConverter.cs
r16720 r16902 38 38 double @const = 0) { 39 39 40 if (factorCoefficients.Length == 0 && coefficients.Length == 0) throw new ArgumentException(); 40 if (factorCoefficients.Length == 0 && coefficients.Length == 0 && @const==0) throw new ArgumentException(); 41 42 // Combine both trees 43 ISymbolicExpressionTreeNode add = (new Addition()).CreateTreeNode(); 41 44 42 45 // Create tree for double variables 43 ISymbolicExpressionTree tree = null;44 46 if (coefficients.Length > 0) { 45 tree = CreateTree(variableNames, new int[variableNames.Length], coefficients, @const); 46 if (factorCoefficients.Length == 0) return tree; 47 var varTree = CreateTree(variableNames, new int[variableNames.Length], coefficients); 48 foreach (var varNode in varTree.IterateNodesPrefix().OfType<VariableTreeNode>()) 49 add.AddSubtree(varNode); 47 50 } 48 51 49 52 // Create tree for string variables 50 ISymbolicExpressionTree factorTree = null;51 53 if (factorCoefficients.Length > 0) { 52 factorTree = CreateTree(factors, factorCoefficients, @const); 53 if (tree == null) return factorTree; 54 var factorTree = CreateTree(factors, factorCoefficients); 55 foreach (var binFactorNode in factorTree.IterateNodesPrefix().OfType<BinaryFactorVariableTreeNode>()) 56 add.AddSubtree(binFactorNode); 54 57 } 55 58 56 // Combine both trees 57 ISymbolicExpressionTreeNode add = tree.Root.GetSubtree(0).GetSubtree(0); 58 foreach (var binFactorNode in factorTree.IterateNodesPrefix().OfType<BinaryFactorVariableTreeNode>()) 59 add.InsertSubtree(add.SubtreeCount - 1, binFactorNode); 59 if (@const!=0.0) { 60 ConstantTreeNode cNode = (ConstantTreeNode)new Constant().CreateTreeNode(); 61 cNode.Value = @const; 62 add.AddSubtree(cNode); 63 } 64 65 ISymbolicExpressionTree tree = new SymbolicExpressionTree(new ProgramRootSymbol().CreateTreeNode()); 66 ISymbolicExpressionTreeNode startNode = new StartSymbol().CreateTreeNode(); 67 tree.Root.AddSubtree(startNode); 68 startNode.AddSubtree(add); 60 69 return tree; 61 62 throw new ArgumentException();63 70 } 64 71 -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionExcelFormatter.cs
r16803 r16902 133 133 stringBuilder.Append(")"); 134 134 } 135 stringBuilder.Append(") ");135 stringBuilder.Append("))"); 136 136 } else if (symbol is Constant) { 137 137 ConstantTreeNode constantTreeNode = node as ConstantTreeNode; -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
r16803 r16902 75 75 76 76 public Interval GetSymbolicExpressionTreeIntervals(ISymbolicExpressionTree tree, IDataset dataset, 77 out Dictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals, IEnumerable<int> rows = null) {77 out IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals, IEnumerable<int> rows = null) { 78 78 var variableRanges = DatasetUtil.GetVariableRanges(dataset, rows); 79 79 return GetSymbolicExpressionTreeIntervals(tree, variableRanges, out nodeIntervals); 80 80 } 81 81 82 public Interval GetSymbolicExpressionTreeInterval(ISymbolicExpressionTree tree, Dictionary<string, Interval> variableRanges) {82 public Interval GetSymbolicExpressionTreeInterval(ISymbolicExpressionTree tree, IDictionary<string, Interval> variableRanges) { 83 83 lock (syncRoot) { 84 84 EvaluatedSolutions++; … … 97 97 98 98 public Interval GetSymbolicExpressionTreeIntervals(ISymbolicExpressionTree tree, 99 Dictionary<string, Interval> variableRanges, outDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals) {99 IDictionary<string, Interval> variableRanges, out IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals) { 100 100 lock (syncRoot) { 101 101 EvaluatedSolutions++; … … 124 124 125 125 126 private static Instruction[] PrepareInterpreterState(ISymbolicExpressionTree tree, Dictionary<string, Interval> variableRanges) {126 private static Instruction[] PrepareInterpreterState(ISymbolicExpressionTree tree, IDictionary<string, Interval> variableRanges) { 127 127 if (variableRanges == null) 128 128 throw new ArgumentNullException("No variablew ranges are present!", nameof(variableRanges)); … … 141 141 } 142 142 143 private Interval Evaluate(Instruction[] instructions, ref int instructionCounter, Dictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals = null) {143 private Interval Evaluate(Instruction[] instructions, ref int instructionCounter, IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals = null) { 144 144 Instruction currentInstr = instructions[instructionCounter]; 145 145 //Use ref parameter, because the tree will be iterated through recursively from the left-side branch to the right side -
branches/2931_OR-Tools_LP_MIP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Selectors/DiversitySelector.cs
r16623 r16902 100 100 #region Events 101 101 private void RegisterParameterEventHandlers() { 102 SelectorParameter.ValueChanged += new EventHandler(SelectorParameter_ValueChanged); 103 CopySelected.ValueChanged += new EventHandler(CopySelected_ValueChanged); 102 SelectorParameter.ValueChanged += SelectorParameter_ValueChanged; 103 CopySelectedParameter.ValueChanged += CopySelectedParameter_ValueChanged; 104 CopySelected.ValueChanged += CopySelected_ValueChanged; 105 } 106 107 private void CopySelectedParameter_ValueChanged(object sender, EventArgs e) { 108 if (CopySelected.Value != true) { 109 CopySelected.Value = true; 110 } 111 CopySelected.ValueChanged += CopySelected_ValueChanged; 104 112 } 105 113
Note: See TracChangeset
for help on using the changeset viewer.