Changeset 16374
 Timestamp:
 12/12/18 16:05:46 (5 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/2966_interval_calculation/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
r16367 r16374 149 149 Interval> intervals = null) { 150 150 Instruction currentInstr = instructions[InstructionCount++]; 151 Interval intermediate= null;151 Interval result = null; 152 152 153 153 switch (currentInstr.opCode) { 154 154 //Elementary arithmetic rules 155 155 case OpCodes.Add: { 156 intermediate= Evaluate(instructions, intervals);157 for (int i = 1; i < currentInstr.nArguments; i++) { 158 intermediate = Interval.Add(intermediate, Evaluate(instructions, intervals));156 result = Evaluate(instructions, intervals); 157 for (int i = 1; i < currentInstr.nArguments; i++) { 158 result = Interval.Add(result, Evaluate(instructions, intervals)); 159 159 } 160 160 break; 161 161 } 162 162 case OpCodes.Sub: { 163 intermediate= Evaluate(instructions, intervals);164 for (int i = 1; i < currentInstr.nArguments; i++) { 165 intermediate = Interval.Subtract(intermediate, Evaluate(instructions, intervals));163 result = Evaluate(instructions, intervals); 164 for (int i = 1; i < currentInstr.nArguments; i++) { 165 result = Interval.Subtract(result, Evaluate(instructions, intervals)); 166 166 } 167 167 break; 168 168 } 169 169 case OpCodes.Mul: { 170 intermediate= Evaluate(instructions, intervals);171 for (int i = 1; i < currentInstr.nArguments; i++) { 172 intermediate = Interval.Multiply(intermediate, Evaluate(instructions, intervals));170 result = Evaluate(instructions, intervals); 171 for (int i = 1; i < currentInstr.nArguments; i++) { 172 result = Interval.Multiply(result, Evaluate(instructions, intervals)); 173 173 } 174 174 break; 175 175 } 176 176 case OpCodes.Div: { 177 intermediate= Evaluate(instructions, intervals);178 for (int i = 1; i < currentInstr.nArguments; i++) { 179 intermediate = Interval.Divide(intermediate, Evaluate(instructions, intervals));177 result = Evaluate(instructions, intervals); 178 for (int i = 1; i < currentInstr.nArguments; i++) { 179 result = Interval.Divide(result, Evaluate(instructions, intervals)); 180 180 } 181 181 break; … … 183 183 //Trigonometric functions 184 184 case OpCodes.Sin: { 185 intermediate= Interval.Sine(Evaluate(instructions, intervals));185 result = Interval.Sine(Evaluate(instructions, intervals)); 186 186 break; 187 187 } 188 188 case OpCodes.Cos: { 189 intermediate= Interval.Cosine(Evaluate(instructions, intervals));189 result = Interval.Cosine(Evaluate(instructions, intervals)); 190 190 break; 191 191 } 192 192 case OpCodes.Tan: { 193 intermediate= Interval.Tangens(Evaluate(instructions, intervals));193 result = Interval.Tangens(Evaluate(instructions, intervals)); 194 194 break; 195 195 } 196 196 //Exponential functions 197 197 case OpCodes.Log: { 198 intermediate= Interval.Logarithm(Evaluate(instructions, intervals));198 result = Interval.Logarithm(Evaluate(instructions, intervals)); 199 199 break; 200 200 } 201 201 case OpCodes.Exp: { 202 intermediate= Interval.Exponential(Evaluate(instructions, intervals));202 result = Interval.Exponential(Evaluate(instructions, intervals)); 203 203 break; 204 204 } 205 205 case OpCodes.Power: { 206 intermediate= Evaluate(instructions, intervals);207 for (int i = 1; i < currentInstr.nArguments; i++) { 208 intermediate = Interval.Power(intermediate, Evaluate(instructions, intervals));206 result = Evaluate(instructions, intervals); 207 for (int i = 1; i < currentInstr.nArguments; i++) { 208 result = Interval.Power(result, Evaluate(instructions, intervals)); 209 209 } 210 210 break; 211 211 } 212 212 case OpCodes.Square: { 213 intermediate= Interval.Square(Evaluate(instructions, intervals));213 result = Interval.Square(Evaluate(instructions, intervals)); 214 214 break; 215 215 } 216 216 case OpCodes.Root: { 217 intermediate= Evaluate(instructions, intervals);218 for (int i = 1; i < currentInstr.nArguments; i++) { 219 intermediate = Interval.Root(intermediate, Evaluate(instructions, intervals));217 result = Evaluate(instructions, intervals); 218 for (int i = 1; i < currentInstr.nArguments; i++) { 219 result = Interval.Root(result, Evaluate(instructions, intervals)); 220 220 } 221 221 break; 222 222 } 223 223 case OpCodes.SquareRoot: { 224 intermediate= Interval.SquareRoot(Evaluate(instructions, intervals));224 result = Interval.SquareRoot(Evaluate(instructions, intervals)); 225 225 break; 226 226 } … … 241 241 242 242 if (intervals != null) 243 intervals.Add(currentInstr.dynamicNode, intermediate);244 return intermediate;243 intervals.Add(currentInstr.dynamicNode, result); 244 return result; 245 245 } 246 246
Note: See TracChangeset
for help on using the changeset viewer.