Example: Sports league scheduling More...
Public Member Functions | |
SportsLeague (const SizeOptions &opt) | |
Setup model. | |
SportsLeague (SportsLeague &s) | |
Constructor for cloning s. | |
virtual Space * | copy (void) |
Copy during cloning. | |
virtual void | print (std::ostream &os) const |
Print solution. | |
![]() | |
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. | |
Protected Member Functions | |
int | weeks (void) const |
Return number of weeks. | |
int | periods (void) const |
Return number of periods. | |
IntVar & | h (int p, int w) |
Home team in period p and week w. | |
const IntVar & | h (int p, int w) const |
Home team in period p and week w. | |
IntVar & | a (int p, int w) |
Away team in period p and week w. | |
const IntVar & | a (int p, int w) const |
Away team in period p and week w. | |
IntVar & | g (int p, int w) |
Return game number for game in period p and week w. | |
const IntVar & | g (int p, int w) const |
Return game number for game in period p and week w. | |
Protected Attributes | |
const int | teams |
number of teams | |
IntVarArray | home |
home teams | |
IntVarArray | away |
away teams | |
IntVarArray | game |
game numbers | |
Related Symbols | |
(Note that these are not member symbols.) | |
int | main (int argc, char *argv[]) |
Main-function. | |
Additional Inherited Members | |
![]() | |
static std::ostream & | select_ostream (const char *sn, std::ofstream &ofs) |
Choose output stream according to sn. | |
template<class Script , template< class > class Engine, class Options > | |
static void | run (const Options &opt, Script *s=NULL) |
Example: Sports league scheduling
See also problem 26 at http://www.csplib.org/.
Definition at line 174 of file sports-league.cpp.
|
inline |
Setup model.
(h,a) and (a,h) are the same game, focus on home (that is, h
Column constraint: each team occurs exactly once
Row constraint: no team appears more than twice
Definition at line 216 of file sports-league.cpp.
|
inline |
Constructor for cloning s.
Definition at line 291 of file sports-league.cpp.
|
inlineprotected |
Return number of weeks.
Definition at line 182 of file sports-league.cpp.
|
inlineprotected |
Return number of periods.
Definition at line 186 of file sports-league.cpp.
|
inlineprotected |
Home team in period p and week w.
Definition at line 190 of file sports-league.cpp.
|
inlineprotected |
Home team in period p and week w.
Definition at line 194 of file sports-league.cpp.
|
inlineprotected |
Away team in period p and week w.
Definition at line 198 of file sports-league.cpp.
|
inlineprotected |
Away team in period p and week w.
Definition at line 202 of file sports-league.cpp.
|
inlineprotected |
Return game number for game in period p and week w.
Definition at line 206 of file sports-league.cpp.
|
inlineprotected |
Return game number for game in period p and week w.
Definition at line 210 of file sports-league.cpp.
|
inlinevirtual |
Copy during cloning.
Definition at line 299 of file sports-league.cpp.
|
inlinevirtual |
Print solution.
Reimplemented from Gecode::Driver::ScriptBase< BaseSpace >.
Definition at line 303 of file sports-league.cpp.
|
related |
Main-function.
Definition at line 333 of file sports-league.cpp.
|
protected |
number of teams
Definition at line 176 of file sports-league.cpp.
|
protected |
home teams
Definition at line 177 of file sports-league.cpp.
|
protected |
away teams
Definition at line 178 of file sports-league.cpp.
|
protected |
game numbers
Definition at line 179 of file sports-league.cpp.