PyPy and constraints

Paddy paddy3118 at netscape.net
Sun Jul 2 18:29:14 EDT 2006


Ziga Seilnacht wrote:
> Paddy wrote:
> > I followed the recent anouncement of version 0.9 of PyPi and found out
> > that there was work included on adding constraint satisfaction solvers
> > to PyPy:
> >   http://codespeak.net/pypy/dist/pypy/doc/howto-logicobjspace-0.9.html
> >
> > I was wondering if this was a possibiity for "mainstream" python, and
> > wether the the algorithms used could handle the kind of use mentioned
> > here:
> >
> > http://groups.google.com/group/comp.lang.python/browse_frm/thread/d297170cfbf1bb34/d4773320e3417d9c?q=constraints+paddy3118&rnum=3#d4773320e3417d9c
> >
> > Thanks, Paddy.
>
> See: http://www.logilab.org/projects/constraint
>
> Hope this helps,
> Ziga

Thanks Ziga,
i had already had a look at that package and its very good.
But, I guess what is different about what is used in the Verification
of electronic designs is the notion of randomized variables.
if you declared a randomized variable R1 and said it was constrained
such that
 0<=R1 <256
Then you could generate values of R1 which would have successive
PSEUDO-RANDOM values between 0 and 255 inclusive.
If you introduced randomized variable R2, with the constraints:
  R2 >=0
  R1*R2 <512

Then you could generate R1,R2 pairs that satisfy the relations and
appear pseudo-random.

Some Electronic Design Automation constraint solvers might generate all
solutions before epeating. but this is not necessary.

The idea is that you electronic designs have a huge state space to test
and so cannot be exaustively tested. If you write a deterministic test
then you are directly loading your test with bias about how you think
the design works or should be tested. With constrained random
generation you work the other way by trying to constrain test segments
to create valid tests but due to the randomness involved, the tests
generated may exercise the design in valid ways that a deterministic
test writer would not have thought of.
The method does work in practice. I'd just like to know if my favourite
language might be changing to have this capability.

- Pad.




More information about the Python-list mailing list