Example: Sports league scheduling More...
Public Member Functions | |
SportsLeague (const SizeOptions &opt) | |
Setup model. | |
SportsLeague (bool share, SportsLeague &s) | |
Constructor for cloning s. | |
virtual Space * | copy (bool share) |
Copy during cloning. | |
virtual void | print (std::ostream &os) const |
Print solution. | |
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 Functions | |
(Note that these are not member functions.) | |
int | main (int argc, char *argv[]) |
Main-function. |
Example: Sports league scheduling
See also problem 26 at http://www.csplib.org/.
SportsLeague::SportsLeague | ( | const SizeOptions & | opt | ) | [inline] |
Setup model.
(h,a) and (a,h) are the same game, focus on home (that is, h<a)
Column constraint: each team occurs exactly once
Row constraint: no team appears more than twice
Definition at line 220 of file sports-league.cpp.
SportsLeague::SportsLeague | ( | bool | share, |
SportsLeague & | s | ||
) | [inline] |
Constructor for cloning s.
Definition at line 294 of file sports-league.cpp.
int SportsLeague::weeks | ( | void | ) | const [inline, protected] |
Return number of weeks.
Definition at line 186 of file sports-league.cpp.
int SportsLeague::periods | ( | void | ) | const [inline, protected] |
Return number of periods.
Definition at line 190 of file sports-league.cpp.
IntVar& SportsLeague::h | ( | int | p, |
int | w | ||
) | [inline, protected] |
Home team in period p and week w.
Definition at line 194 of file sports-league.cpp.
const IntVar& SportsLeague::h | ( | int | p, |
int | w | ||
) | const [inline, protected] |
Home team in period p and week w.
Definition at line 198 of file sports-league.cpp.
IntVar& SportsLeague::a | ( | int | p, |
int | w | ||
) | [inline, protected] |
Away team in period p and week w.
Definition at line 202 of file sports-league.cpp.
const IntVar& SportsLeague::a | ( | int | p, |
int | w | ||
) | const [inline, protected] |
Away team in period p and week w.
Definition at line 206 of file sports-league.cpp.
IntVar& SportsLeague::g | ( | int | p, |
int | w | ||
) | [inline, protected] |
Return game number for game in period p and week w.
Definition at line 210 of file sports-league.cpp.
const IntVar& SportsLeague::g | ( | int | p, |
int | w | ||
) | const [inline, protected] |
Return game number for game in period p and week w.
Definition at line 214 of file sports-league.cpp.
virtual Space* SportsLeague::copy | ( | bool | share | ) | [inline, virtual] |
Copy during cloning.
Definition at line 302 of file sports-league.cpp.
virtual void SportsLeague::print | ( | std::ostream & | os | ) | const [inline, virtual] |
Print solution.
Reimplemented from Gecode::Driver::ScriptBase.
Definition at line 306 of file sports-league.cpp.
int main | ( | int | argc, |
char * | argv[] | ||
) | [related] |
Main-function.
Definition at line 336 of file sports-league.cpp.
const int SportsLeague::teams [protected] |
number of teams
Definition at line 180 of file sports-league.cpp.
IntVarArray SportsLeague::home [protected] |
home teams
Definition at line 181 of file sports-league.cpp.
IntVarArray SportsLeague::away [protected] |
away teams
Definition at line 182 of file sports-league.cpp.
IntVarArray SportsLeague::game [protected] |
game numbers
Definition at line 183 of file sports-league.cpp.