Generated on Tue Apr 18 10:22:59 2017 for Gecode by doxygen 1.6.3

CartesianHeart Class Reference
[Example scripts (models)]

Example: Cartesian Heart More...

List of all members.

Public Member Functions

 CartesianHeart (const Options &opt)
 Actual model.
 CartesianHeart (bool share, CartesianHeart &p)
 Constructor for cloning p.
virtual Spacecopy (bool share)
 Copy during cloning.
virtual void constrain (const Space &_b)
 Add constraints to current model to get next solution (not too close).
virtual void print (std::ostream &os) const
 Print solution coordinates.

Protected Attributes

FloatVarArray f
 The numbers.
FloatNum step
 Minimum distance between two solutions.

Detailed Description

Example: Cartesian Heart

There are many mathematical curves that produce heart shapes. With a good solving effort, coordinates of a filled heart shape can be computed by solving the cartesian equation:

\[ x^2+2\left(y-p\times\operatorname{abs}(x)^{\frac{1}{q}}\right)^2 = 1 \]

By setting $p=0.5$ and $q=2$, it yields to the equation:

\[ x^2+2\left(y-\frac{\operatorname{abs}(x)^{\frac{1}{2}}}{2}\right)^2 = 1 \]

To get reasonable interval starting sizes, $x$ and $y$ are restricted to $[-20;20]$.

Definition at line 67 of file cartesian-heart.cpp.

Constructor & Destructor Documentation

CartesianHeart::CartesianHeart ( const Options opt  )  [inline]

Actual model.

Definition at line 75 of file cartesian-heart.cpp.

CartesianHeart::CartesianHeart ( bool  share,
CartesianHeart p 
) [inline]

Constructor for cloning p.

Definition at line 85 of file cartesian-heart.cpp.

Member Function Documentation

virtual Space* CartesianHeart::copy ( bool  share  )  [inline, virtual]

Copy during cloning.

Definition at line 90 of file cartesian-heart.cpp.

virtual void CartesianHeart::constrain ( const Space _b  )  [inline, virtual]

Add constraints to current model to get next solution (not too close).

Definition at line 94 of file cartesian-heart.cpp.

virtual void CartesianHeart::print ( std::ostream &  os  )  const [inline, virtual]

Print solution coordinates.

Reimplemented from Gecode::Driver::ScriptBase< BaseSpace >.

Definition at line 102 of file cartesian-heart.cpp.

Member Data Documentation

The numbers.

Definition at line 70 of file cartesian-heart.cpp.

FloatNum CartesianHeart::step [protected]

Minimum distance between two solutions.

Definition at line 72 of file cartesian-heart.cpp.

The documentation for this class was generated from the following file: