[PPL-devel] Prolog (and C++) interfaces toot lax?
Enea Zaffanella
zaffanella at cs.unipr.it
Thu Mar 14 09:00:26 CET 2002
Roberto Bagnara wrote:
>
> Dear all,
>
> while I was trying the Prolog interfaces, I wrote
>
> ppl_relation_with_generator(P, point(1), L)
>
> which was happily accepted, but then I got a wrong result.
> What I meant to write was
>
> ppl_relation_with_generator(P, point(X), L)
>
> or, for more verbosity,
>
> ppl_relation_with_generator(P, point(1*X), L).
>
> Thus I thought I should change the code of the Prolog interface
> so that an exception is thrown in case of invalid generators
> such as point(1). But then I realized that silly generators
> can also be created in C++, even though one needs to be more
> motivation to come up with things like
>
> Generator g(point(LinExpression(1)));
>
> Should we disallow these things also in C++?
> Are there other places were we are a bit sloppy?
> Please, let me know what you think.
> Ciao
>
> Roberto
>
Well ... the documentation is enough clear on that point:
Linear expressions used to define a generator should be homogeneous
(any constant term will be simply ignored).
We could help the user by throwing an exception whenever the costant
term is different from zero ... however, this would not solve all of our
problems, because a user writing
Generator g(point(LinExpression(0)));
may (wrongly) assume that he/she has just created the origin of the
1-dimension space ... whereas the above instruction creates the (one and
only) zero-dim point.
I know that dimensions are automatically adjusted when working with
constraints (systems) and generators (systems) ... but consider the
following case:
GenSys gs;
gs.insert(point(LinExpression(0)));
Polyhedron ph(gs);
This will create a zero-dim polyhedron ... which is NOT what the
(uneducated) user was expecting. The only way to avoid this second
problem is to _require_ the user to declare the space dimension of a
polyhedron whenever building it from a GenSys (and, for consistency,
from a ConSys too).
OR, just stress even more this point in the manual and rpetend the user
to be aware of it.
Is anyone foreseeing any other solution ?
Enea.
More information about the PPL-devel
mailing list