Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost] [review][constrained_value] Review of ConstrainedValueLibrary begins today
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2008-12-07 22:38:01


I wasn't sure if anyone was allowed to review, but if so, then all of my
questions have been answered:

Library Review:
>
> - What is your evaluation of the design?
I can't comment on it as a generic library designer, but as a library user
it appears to be an excellent framework. However, the use cases for bounds
checking of variables are much more thought through than the more
interesting mathematics/set theory and numerics use cases. I think the
library seems to be close to supporting these use cases but needs to
explicitly address:
1) Floating Points: Enough has been said about this, but it needs to be
resolved before the library is completed. Otherwise, all
mathematics/numerics use cases are impossible. As a pragmatist about this
issue, I would say that a worst case "solution" is to write caveats in the
"rationale" section about this problem when using this library. This
library is useful for querying bounds on a type, even if it doesn't do any
bounds checking.

2) Dynamic Bounded Types: Right now the static bounds are associated
globally with a type, and the dynamic bounds are associated with an instance
of a type. Since many use cases involve setting dynamic sets and then
creating instances, it is crucial that this type of set is implemented. See
Robert's rough notes in:
http://lists.boost.org/boost-users/2008/12/42959.php

3) Representing Disjoint Sets: Because most of the use cases have been
thinking about predicates and bounds checking, the key use cases of unions
of bounds has not been addressed. In most of the discussions, people talk
about layering constraints on top of each other, which is an intersection.
This library needs to also have ways to easily create sets like: (-infinity,
0] union [1,2] union [3,infinity) This would be a union of constraints
which could be set or accessed on the type (at runtime or compiletime),
hopefully with simple iterators to access this type information. I think
that thinking through closed/open/halfopen/etc. intervals as separate
objects in themselves is critical, especially to layer this type of bound
on. Perhaps it could be integrated with the interval template library in
the sandbox for example.

4) Testing with Numerics: This library needs to be tested with key boost
numeric packages such as ublas, boost math, accumulators, etc. The key here
will also be to verify that it compiles with the static and dynamic bounded
types, the storage is identical to the underlying type, and the operations
it generates are not any slower. Also that all of the elementary operators
on intrinsic types in C++ work as normal for by value/ref/pointer,
numeric_limits is thought through, etc. All of the former is
performance/storage testing would be conditional on a good compiler of
course (gnu and Intel seem to be the main ones to worry about)

> - What is your evaluation of the implementation?
For the existing constraint types, it looks good.

> - What is your evaluation of the documentation?
Good for the simple cases here and the bounds checking. Incomplete for the
key math/numerics use cases which is where this would be at its best. And
the floating point section would need to be rewritten after it is "solved".

> - What is your evaluation of the potential usefulness of the library?
Extraordinarily useful for generic mathematics/numerics. Even without any
bounds checking, managing subsets of intrinsic types with runtime bounds
information has a huge value. And having domains/ranges associated with
functions would save a huge number of bugs in numeric processing, as well as
make the translation from blackboard to program much more elegant. This
could be a cornerstone of allowing for safe implementations of mathematical
models in disciplines such as economics. For example, an optimizer
operating on bounded values could create a grid from just the passed in
type, validate if a solution is converging to an open set bound, etc. And
higher order functors such as derivatives could generate domain/range
information for the functions they are operating on dynamically.

> - Did you try to use the library? With what compiler? Did you have any
> problems?
No. It doesn't yet have the main constraint type I am interested in.

> - How much effort did you put into your evaluation? A glance? A quick
> reading? In-depth study?
I had previously been writing notes on a library to manage domain/range
information for functors that this becomes a superset of, so I have thought
through a large number of those use cases. A great deal of time was spent
trying to see how this library could fit the use cases I am interested in.

> - Are you knowledgeable about the problem domain?
>
For generic library design: little knowledge. For the bounds-checking,
value monitoring use cases: little knowledge. For the mathematics/numerics
use cases: A good deal of knowledge as I am working through many of these
issues in projects/research and trying to build out domain specific
libraries to make future research easier..

> Please state in your review, whether you think the library should be
> accepted as a Boost library.
Yes, conditional on solving the 1) to 4) design questions above. Robert has
posted excellent starting points for many of these topics.



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