Open wbernoudy opened 2 weeks ago
I tried out some more complicated things to support custom exception handling in Cython. I put it in a separate branch for now as I'm not sure we'll go that direction. Separate PR here to try to make it a bit easier to review https://github.com/wbernoudy/dwave-optimization/pull/1
Adds
InputNode
which subclassesConstantNode
but allows assigning of the state after initialization.This is to support the new
NaryReduceNode
, which does an n-ary reduce operation on an arbitrary number of inputs/predecessors. The node is constructed by providing an expression, formulated as a separateGraph
, and initial values for the reduction operation.The current design accepts any
Graph
but then throws exceptions if it contains unsupported nodes. It would be best if we can pass along helpful error messages to users at the python level. Currently this works by encoding the error message and aNode*
in a simple JSON string that is then parsed from Python, where we can grab the corresponding symbol.