Boost logo

Boost Users :

From: john (john.ettedgui_at_[hidden])
Date: 2007-11-14 17:16:11


Guillaume Melquiond <guillaume.melquiond <at> ens-lyon.fr> writes:

>
>
> Sorry, I don't understand what you mean by solving boolean expressions.
> So my reply may be off. Please detail a bit more if that is so.
I want to simplify the expression as much as possible.
IE if I have as input to my program " ( (1,15) AND ( 10,20) ) OR (25,30)"
I want to get as output " (10,15) OR (25,30)"

> Note that you can use distributivity of one operation with respect to
> the other. Your example can be transformed into (I1 AND I3) OR (I2 AND
> I3), which is as simple to solve as your first case, since all the
> unions have been moved to the top of the expression.
Yep, that is the option I have in mind, I just don't have the slightest idea as
how to do that on big expressions keeping priorities. Well it's probably
feasible I just need to think a little more.

>
> Unfortunately, the interval library does not provide any helper code to
> handle (disjoint) sets of intervals. This should not be too hard to
> implement in your own code though. For example, you can decide to
> represent these sets with the type std::list< interval<...> > and with
> the invariant that the upper bound of an interval in a list is strictly
> less than the lower bound of the next interval of the list. Then union
> and intersection become operations with linear complexity in the size of
> the lists.
Can you elaborate on that part please? Do you mean something like having my own
function working on those lists and then the small elements would be passed to
the existing functions withing Interval?

>
> Best regards,
>
> Guillaume
>

Thank you for your help.

John


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net