Generated on Thu Apr 11 13:59:39 2019 for Gecode by doxygen 1.6.3

GoldenSpiral Class Reference
[Example scripts (models)]

Example: Golden spiral More...

List of all members.

Public Member Functions

 GoldenSpiral (const Options &opt)
 Actual model.
 GoldenSpiral (GoldenSpiral &p)
 Constructor for cloning p.
virtual Spacecopy (void)
 Copy during cloning.
virtual FloatVar cost (void) const
 Cost function.
virtual void print (std::ostream &os) const
 Print solution coordinates.

Protected Attributes

FloatVarArray f
 The numbers.

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 77 of file golden-spiral.cpp.


Constructor & Destructor Documentation

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

Actual model.

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

GoldenSpiral::GoldenSpiral ( GoldenSpiral p  )  [inline]

Constructor for cloning p.

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


Member Function Documentation

virtual Space* GoldenSpiral::copy ( void   )  [inline, virtual]

Copy during cloning.

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

virtual FloatVar GoldenSpiral::cost ( void   )  const [inline, virtual]

Cost function.

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

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

Print solution coordinates.

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

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


Member Data Documentation

The numbers.

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


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