Example: simple routes of unknown length More...
Public Types | |
| enum | { BRANCH_INCREMENTAL , BRANCH_LENGTH } |
| Branching to use for the route. More... | |
Public Member Functions | |
| OpenRoute (const Options &opt) | |
| Construct the model. | |
| OpenRoute (OpenRoute &s) | |
| Constructor for cloning s, including the space-local open list. | |
| Space * | copy (void) override |
| Perform copying during cloning. | |
| void | print (std::ostream &os) const override |
| Print the materialized route (complete in a solution). | |
| Public Member Functions inherited from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< Space > > | |
| 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::IgnoreStepOption< BaseSpace > | |
| IgnoreStepOption (const Options &) | |
| Constructor. | |
| IgnoreStepOption (BaseSpace &e) | |
| Constructor used for cloning. | |
Protected Attributes | |
| OpenIntVarList | route |
| Node IDs in route order, including source and destination. | |
Static Protected Attributes | |
| static const int | node_count = 5 |
| Number of graph nodes and maximal route length. | |
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::IgnoreStepOption< Space > > | |
| 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=nullptr) |
Detailed Description
Example: simple routes of unknown length
Find all simple routes from node 0 to node 4 in this directed graph: 0 -> 1, 2, 4 1 -> 2, 4 2 -> 1, 3 3 -> 2, 4
The graph contains cycles, but distinct node variables exclude revisits. A simple route uses at most five nodes, which bounds the list length without excluding any routes.
Definition at line 54 of file open-route.cpp.
Member Enumeration Documentation
◆ anonymous enum
| anonymous enum |
Branching to use for the route.
| Enumerator | |
|---|---|
| BRANCH_INCREMENTAL | Assign the current prefix before extending it. |
| BRANCH_LENGTH | Choose the complete route length first. |
Definition at line 62 of file open-route.cpp.
Constructor & Destructor Documentation
◆ OpenRoute() [1/2]
|
inline |
Construct the model.
Definition at line 68 of file open-route.cpp.
◆ OpenRoute() [2/2]
|
inline |
Constructor for cloning s, including the space-local open list.
Definition at line 89 of file open-route.cpp.
Member Function Documentation
◆ copy()
|
inlineoverride |
Perform copying during cloning.
Definition at line 95 of file open-route.cpp.
◆ print()
|
inlineoverridevirtual |
Print the materialized route (complete in a solution).
Reimplemented from Gecode::Driver::ScriptBase< Driver::IgnoreStepOption< Space > >.
Definition at line 101 of file open-route.cpp.
Friends And Related Symbol Documentation
◆ main()
|
Main-function.
Definition at line 116 of file open-route.cpp.
Member Data Documentation
◆ node_count
|
staticprotected |
Number of graph nodes and maximal route length.
Definition at line 57 of file open-route.cpp.
◆ route
|
protected |
Node IDs in route order, including source and destination.
Definition at line 59 of file open-route.cpp.
The documentation for this class was generated from the following file:
- examples/open-route.cpp
