# [PPL-devel] Fwd: Question regarding OCaml Interface of PPL

Roberto Bagnara roberto.bagnara at bugseng.com
Tue Mar 6 21:33:49 CET 2012

```
-------- Original Message --------
Subject: Question regarding OCaml Interface of PPL
Date: Tue, 6 Mar 2012 13:49:10 -0500
From: Brian Pak <bpak at andrew.cmu.edu>
To: support at bugseng.com

Hi all,

I'm a student in Carnegie Mellon University in US, and trying to use PPL for my research project.

First, thank you for your great work! It is truly amazing :)

I was fiddling with the library and interfaces (especially OCaml), and got stuck on one thing. I wanted to use 'get_interval' or 'get_lower/upper_bound' functions in Box class, but it seems it's not available in OCaml interface. Is there any way to get around this?

I'm not too familiar with these mathematical concepts (I'm reading materials to grasp better understanding, though), but here's what I want to accomplish:
- Given n variables where each of them is bounded (in some linear relation) -- build a constraint system out of these
- Generate an n-polytope that above equations describe (currently planning to use C_Polyhedron)
- I want to enumerate integer points in this polytope, but that's known to be difficult (please correct me if I'm wrong)
- Create an n-dimensional Box object from C_Polyhedron we generated (which is basically a hyper-rectangle surrounding the polytope, possibly?)
- Get the interval (low and upper bound) for each variable for the Box above.
- Pick a random point in the Box (hopefully this is easier since we know the interval of each dimension)
- Perform a rejection sampling to check if the picked point is contained in the polytope.
- There doesn't seem to be a way to do this natively, so I'm planning to use the trick where I make a very small polytope that is constrained by Variable(0) == c_1 && Variable(1) == c_2 && … && Variable(n-1) == c_n, and use 'contains' function to check if it's contained in the polytope (represented by C_Polyhedron object above).