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

Example: Golden spiral More...

Public Member Functions

 GoldenSpiral (const Options &)
 Actual model. More...
 
 GoldenSpiral (bool share, GoldenSpiral &p)
 Constructor for cloning p. More...
 
virtual Spacecopy (bool share)
 Copy during cloning. More...
 
virtual void constrain (const Space &_b)
 Add constraint 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: Golden spiral

The Golden Spiral is a logarithmic spiral whose growth factor is the golden ratio $\phi=1,618$.

It is defined by the polar equation:

\[ r = ae^{b\theta} \]

where

\[ \operatorname{abs}(b) = \frac{\operatorname{ln}(\phi)}{\frac{\pi}{2}} \]

To get cartesian coordinates, it can be solved for $x$ and $y$ in terms of $r$ and $\theta$. By setting $a=1$, it yields to the equation:

\[ r = e^{0.30649\times\theta} \]

with

\[ x=r\operatorname{cos}(\theta), \quad y=r\operatorname{sin}(\theta) \]

The tuple $(r,\theta)$ is related to the position for $x$ and $y$ on the curve. $r$ and $\theta$ are positive numbers.

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

Definition at line 81 of file golden-spiral.cpp.

Constructor & Destructor Documentation

GoldenSpiral::GoldenSpiral ( const Options )
inline

Actual model.

Definition at line 89 of file golden-spiral.cpp.

GoldenSpiral::GoldenSpiral ( bool  share,
GoldenSpiral p 
)
inline

Constructor for cloning p.

Definition at line 105 of file golden-spiral.cpp.

Member Function Documentation

virtual Space* GoldenSpiral::copy ( bool  share)
inlinevirtual

Copy during cloning.

Definition at line 110 of file golden-spiral.cpp.

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

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

Definition at line 114 of file golden-spiral.cpp.

virtual void GoldenSpiral::print ( std::ostream &  os) const
inlinevirtual

Print solution coordinates.

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

Definition at line 119 of file golden-spiral.cpp.

Friends And Related Function Documentation

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

Main-function.

Definition at line 129 of file golden-spiral.cpp.

Member Data Documentation

FloatVarArray GoldenSpiral::f
protected

The numbers.

Definition at line 84 of file golden-spiral.cpp.

FloatNum GoldenSpiral::step
protected

Minimum distance between two solutions.

Definition at line 86 of file golden-spiral.cpp.


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