
Example: Golden spiral More...
Public Member Functions | |
| GoldenSpiral (const Options &opt) | |
| Actual model. | |
| GoldenSpiral (GoldenSpiral &p) | |
| Constructor for cloning p. | |
| virtual Space * | copy (void) |
| Copy during cloning. | |
| virtual FloatVar | cost (void) const |
| Cost function. | |
| virtual void | print (std::ostream &os) const |
| Print solution coordinates. | |
Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::ExtractStepOption< FloatMaximizeSpace > > | |
| ScriptBase (const Options &opt) | |
| Constructor. | |
| ScriptBase (ScriptBase &e) | |
| Constructor used for cloning. | |
| virtual void | compare (const Space &home, std::ostream &os) const |
| Compare with s. | |
| ScriptBase (const Options &opt) | |
| Constructor. | |
| ScriptBase (ScriptBase &e) | |
| Constructor used for cloning. | |
| virtual void | compare (const Space &home, std::ostream &os) const |
| Compare with s. | |
Public Member Functions inherited from Gecode::Driver::ExtractStepOption< BaseSpace > | |
| ExtractStepOption (const Options &opt) | |
| Constructor that extracts the step value. | |
| ExtractStepOption (BaseSpace &e) | |
| Constructor used for cloning. | |
Protected Attributes | |
| FloatVarArray | f |
| The numbers. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| int | main (int argc, char *argv[]) |
| Main-function. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::ExtractStepOption< FloatMaximizeSpace > > | |
| static std::ostream & | select_ostream (const char *sn, std::ofstream &ofs) |
| Choose output stream according to sn. | |
| static void | run (const Options &opt, Script *s=NULL) |
| static std::ostream & | select_ostream (const char *sn, std::ofstream &ofs) |
| Choose output stream according to sn. | |
| static void | run (const Options &opt, Script *s=NULL) |
Example: Golden spiral
The Golden Spiral is a logarithmic spiral whose growth factor is the golden ratio 
It is defined by the polar equation:
![\[r = ae^{b\theta}
\]](form_43.png)
where
![\[\operatorname{abs}(b) = \frac{\operatorname{ln}(\phi)}{\frac{\pi}{2}}
\]](form_44.png)
To get cartesian coordinates, it can be solved for 




![\[r = e^{0.30649\times\theta}
\]](form_45.png)
with
![\[x=r\operatorname{cos}(\theta), \quad y=r\operatorname{sin}(\theta)
\]](form_46.png)
The tuple 




To get reasonable interval starting sizes, 

![$[-20;20]$](form_21.png)
Definition at line 77 of file golden-spiral.cpp.
|
inline |
Actual model.
Definition at line 83 of file golden-spiral.cpp.
|
inline |
Constructor for cloning p.
Definition at line 99 of file golden-spiral.cpp.
|
inlinevirtual |
Copy during cloning.
Definition at line 104 of file golden-spiral.cpp.
|
inlinevirtual |
Cost function.
Definition at line 108 of file golden-spiral.cpp.
|
inlinevirtual |
Print solution coordinates.
Reimplemented from Gecode::Driver::ScriptBase< Driver::ExtractStepOption< FloatMaximizeSpace > >.
Definition at line 112 of file golden-spiral.cpp.
|
Main-function.
Definition at line 122 of file golden-spiral.cpp.
|
protected |
The numbers.
Definition at line 80 of file golden-spiral.cpp.