
Example: Golden spiral More...
Public Member Functions | |
| GoldenSpiral (const Options &opt) | |
| Actual model. More... | |
| GoldenSpiral (bool share, GoldenSpiral &p) | |
| Constructor for cloning p. More... | |
| virtual Space * | copy (bool share) |
| Copy during cloning. More... | |
| virtual FloatVar | cost (void) const |
| Cost function. More... | |
| virtual void | print (std::ostream &os) const |
| Print solution coordinates. More... | |
Public Member Functions inherited from Gecode::Driver::ScriptBase< BaseSpace > | |
| ScriptBase (const Options &opt) | |
| Constructor. More... | |
| ScriptBase (bool share, ScriptBase &e) | |
| Constructor used for cloning. More... | |
| virtual void | compare (const Space &home, std::ostream &os) const |
| Compare with s. More... | |
Protected Attributes | |
| FloatVarArray | f |
| The numbers. 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) |
Example: Golden spiral
The Golden Spiral is a logarithmic spiral whose growth factor is the golden ratio
.
It is defined by the polar equation:
where
To get cartesian coordinates, it can be solved for
and
in terms of
and
. By setting
, it yields to the equation:
with
The tuple
is related to the position for
and
on the curve.
and
are positive numbers.
To get reasonable interval starting sizes,
and
are restricted to
.
Definition at line 81 of file golden-spiral.cpp.
|
inline |
Actual model.
Definition at line 87 of file golden-spiral.cpp.
|
inline |
Constructor for cloning p.
Definition at line 103 of file golden-spiral.cpp.
|
inlinevirtual |
Copy during cloning.
Definition at line 108 of file golden-spiral.cpp.
|
inlinevirtual |
Cost function.
Definition at line 112 of file golden-spiral.cpp.
|
inlinevirtual |
Print solution coordinates.
Reimplemented from Gecode::Driver::ScriptBase< BaseSpace >.
Definition at line 116 of file golden-spiral.cpp.
|
related |
Main-function.
Definition at line 126 of file golden-spiral.cpp.
|
protected |
The numbers.
Definition at line 84 of file golden-spiral.cpp.