virtualcell / vcell

Virtual Cell Framework
http://vcell.org/
Other
66 stars 20 forks source link

JSCL simplify takes too long for some expressions #339

Closed jcschaff closed 1 year ago

jcschaff commented 2 years ago

JSCL simplify takes too long for some expressions, especially those which have rational expressions raised to a power greater than 3. For example, one expression encountered when running the omex round trip on published models consumes 240 seconds on a single expression simplification (sorry, I didn't save that expression).

JSCL simplification is now used during import/export and certain model transformations to cancel unit factors. There are currently some heuristics to skip this more expensive simplification for long expressions (fails over to Expression.flatten() when the infix string length of original expressions and intermediate expressions are longer than 100 characters.

Need to either understand how to limit the computation by one of the following:

  1. altering the JSCL algorithm to introduce computational limits
  2. or, make the simplification a process which is cancelable with a timeout
  3. or, be more surgical in our use of this library.

see ExpressionUtils.simplifyUsingJSCL() and some unit tests in ExpressionUtilsJSCLFlattenTest for background.

ACowan0105 commented 1 year ago

@jcschaff can we close this?

jcschaff commented 1 year ago

closed as part of #373