More Examples
[ Back ] [ Home ] [ Next ]

 

Constraints as Data
Potential Apps
Query by Example
Query by Example
Query by Example
More Examples
Model and Language
Main Features
Hosting Iterative Lang.
Constraint Calculus
Constraint Calculus
Polynomial Complexity
Query Evaluation
Functionality
Optimization
Optimization
Optimization
Optimization
Implemented Apps
Implemented Apps

More Examples

FO + Linear constraints are fairly expressive. In particular, FO + Linear expresses any linear transformations such as rotation, translation and stretch; check discreteness and boundness, emptiness, containment, disjointness; compute convex hulls (of a bounded number of points), augment and join objects, change coordinate systems, etc. For example, the CCUBE CST-algebra expression

     (x,y,z) | (x = a_1 * t_1 + ... + a_{10} * t_{10} &&
                y = b_1 * t_1 + ... + b_{10} * t_{10} &&
                z = c_1 * t_1 + ... + c_{10} * t_{10} &&
                t_1 >= 0 + ... + t_{10} >= 0 &&
                t_1 + ... + t_{10} = 1)

gives the convex hull of 10 3D-points (a_1,b_1,c_1),...,(a_10,b_10,c_10).

As another example, suppose we have two 2D CST objects, o1 in variables u,v and o2 in variables x,y. Joining the two objects, based on v == x, can be expressed in CCUBE as (u,v,y) | (o1 && o2 && y == v) or as (u,v,y) | (o1 && o2.rename(x/v))

Still, many important notions cannot be expressed with linear constraints. In particular, the Euclidean distance which can be expressed using (convex) quadratic function, is not linearly expressible. As an example, if we have a collection Desks_in_room, where extent of each room is given in the room's coordinates x,y, the following query (which uses quadratic constraints, and thus would not currently run on CCUBE) would find all pairs of (references to) desks that are within 10 cm of each other:

       SELECT pair(dsk1,dsk2)
       INTO   {Set<pair<DESK*>>} result
       FROM   Desks_in_room AS {DESK*} dsk1
              Desks_in_room AS {DESK*} dsk2
       WHERE  SAT(dsk1->extent.rename(x/x1,y/y2) && 
                  dsk2->extent.rename(x/x2,y/y2) &&
                  (x1 - x2)^2 + (y1 - y2)^2 <= 10))

However, if, for example, we were to find all pairs of desks that touch (or intersect) each other, we would just replace the content of the WHERE clause with SAT(dsk1.extent && dsk2.extent) which runs in CCUBE.


presentation created by Victor E. Segal