Free cookie consent management tool by TermsFeed Policy Generator

Opened 10 years ago

Closed 9 years ago

#2344 closed enhancement (done)

Improve Calculator

Reported by: pfleck Owned by: pfleck
Priority: medium Milestone: HeuristicLab 3.3.12
Component: Optimization Version: 3.3.11
Keywords: Cc:

Description

The Optimization.Calculator (used for RunCollectionFormulaModifier and ExpressionCalculator) can only return boolean, double or string values. To explicit convert the result to int, a toInt function is required.

Furthermore, the Calculator can only use bool, int, double and string values as variables. By introducing a new [] operator, also arrays (e.g., IntArray) can be used.

Change History (8)

comment:1 Changed 10 years ago by pfleck

  • Status changed from new to accepted

comment:2 Changed 10 years ago by pfleck

r12091

  • Added a toint and todouble function.
  • Changed the casts to the a more intelligent Convert.ToDouble/Int to avoid unboxing issues e.g. when casting a boxed int to double. Note that Convert.ToInt32 has a slightly different behavior than a int-cast (rounds when converting double->int), but this does not break any compatibility since we never converted to int before.

comment:3 Changed 10 years ago by pfleck

r12096 Added []-operator for accessing arrays. Note that a more generic implementation is difficult because there is no non-generic implementation of ValueTypeArray and casting to IEnumerable<object> does not work due to the generic constraint of ValueTypeArray.

comment:4 Changed 10 years ago by pfleck

r12114 Updated parameter description of ExpressionCalculator and RunCollectionFormulaModifer to include the new functions.

comment:5 Changed 9 years ago by pfleck

  • Owner changed from pfleck to mkommend
  • Status changed from accepted to reviewing

comment:6 Changed 9 years ago by mkommend

  • Owner changed from mkommend to epitzer

comment:7 Changed 9 years ago by epitzer

  • Owner changed from epitzer to pfleck
  • Status changed from reviewing to readytorelease

looks very good, thanks for the update

comment:8 Changed 9 years ago by mkommend

  • Resolution set to done
  • Status changed from readytorelease to closed

r12719: Merged r12091, r12096 and r12114 into stable.

Note: See TracTickets for help on using tickets.