Generated on Sat Feb 7 2015 02:01:38 for Gecode by doxygen 1.8.9.1
CartesianHeart Class Reference

Example: Cartesian Heart More...

Public Member Functions

 CartesianHeart (const Options &)
 Actual model. More...
 
 CartesianHeart (bool share, CartesianHeart &p)
 Constructor for cloning p. More...
 
virtual Spacecopy (bool share)
 Copy during cloning. More...
 
virtual void constrain (const Space &_b)
 Add constraints to current model to get next solution (not too close) More...
 
virtual void print (std::ostream &os) const
 Print solution coordinates. More...
 
- Public Member Functions inherited from Gecode::Driver::ScriptBase< BaseSpace >
 ScriptBase (void)
 Default constructor. More...
 
 ScriptBase (bool share, ScriptBase &e)
 Constructor used for cloning. More...
 
virtual void compare (const Space &, std::ostream &os) const
 Compare with s. More...
 

Protected Attributes

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

Related Functions

(Note that these are not member functions.)

int main (int argc, char *argv[])
 Main-function. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Gecode::Driver::ScriptBase< BaseSpace >
static std::ostream & select_ostream (const char *name, std::ofstream &ofs)
 Choose output stream according to name. More...
 
template<class Script , template< class > class Engine, class Options >
static void run (const Options &opt, Script *s=NULL)
 

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 )
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)
inlinevirtual

Copy during cloning.

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

virtual void CartesianHeart::constrain ( const Space _b)
inlinevirtual

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
inlinevirtual

Print solution coordinates.

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

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

Friends And Related Function Documentation

int main ( int  argc,
char *  argv[] 
)
related

Main-function.

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

Member Data Documentation

FloatVarArray CartesianHeart::f
protected

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: