Sometimes variables get instantiated with bounded reals and it leads to conversion error in pyclp.pyx in line 634:
raise pyclpEx("Unknown type returned by eclipse").
To avoid it I need to convert all 'out' variables manually with float/2. But in some cases I don't now which of them are 'in' and which are 'out'.
For example, a clause for unit conversion:
unitconv((X, MX), (Y, MY)) :-
units_list(MX, L),
units_list(MY, L),
subtract(L, [MX, MY], LUnused),
conv((X, MX), (Z, MY), LUnused),
Y is float(Z). % reading bounded real Z gives exception in pyclp
Here, if Y is given, X may also become bounded real, so I need to check both.
What I need is just:
unitconv((X, MX), (Y, MY)) :-
units_list(MX, L),
units_list(MY, L),
subtract(L, [MX, MY], LUnused),
conv((X, MX), (Y, MY), LUnused).
Of course, checking before converting makes code more bulky.