Closed Raffarti closed 3 years ago
This issue is related with the problem of checking the equality between two objects (in this case, the equality of the two facts and, more specifically, their tau
variables).
Since objects might have fields, the equality of two objects might depend from the equality of their fields (deep equals), resulting in a tree of equality checks. This tree is currently visited in depth (recursive step at line 66):
https://github.com/pstlab/oRatio/blob/0ec136fc60240e6cf090c8a6ba5055f84a215ac1/core/item.cpp#L60-L72
leading, in some cases, to a stack overflow (r==r1
if r.ctrl==r1.ctrl
if r.ctrl.rover==r1.ctrl.rover
if r.ctrl.rover.ctrl==r1.ctrl.rover.ctrl
, etc...).
This check has to be reimplemented so as to visit the tree in breadth.
Since object's fields are stored on a (ordered) map, a possible workaround is to name the fields in a way such that primitive objects (e.g., the Rover's id) appear, alphabetically, first.
currently, two instances are considered equal if their properties are equal. however, it is probably much simpler (and correct!) to consider two different objects just different, limiting deep equality check to the case of atoms.
consider two different objects just different
As in
Object o0 = new Object();
Object o1 = new Object();
would be considered different and no longer requiring an id
field for instance?
Precisely!
way much simpler and no need of boilerplate ids..
thanks for pointing it out! :wink:
This rddl is encourring in segmentation fault, but just renaming
ctrl
torctrl
does not. Some names works, others not. Commenting outr_at1
does also work.