SportsLeague Class Reference
[Example scripts (models)]
Inherits Example.
Detailed Description
Example: Sports League SchedulingProb026: round robin tournaments from http://www.csplip.org
- There are
teams (
even).
- The season lasts
weeks.
- Each game between two different teams occurs exactly once.
- Every team plays one game in each week of the season.
- There are
periods and each week every period is scheduled for one game.
- No team plays more than twice in the same period over the course of the season.
Definition at line 59 of file sports-league.cc.
Public Member Functions | |
IntVar & | h (int p, int w) |
Access the home team in period p and week w. | |
IntVar & | a (int p, int w) |
Access the away team in period p and week w. | |
IntVar & | g (int p, int w) |
Access the game number associated with the game in period p and week w. | |
Play & | rrs (int p, int w) |
Access the entry in the round robin schedule for period p and week w. | |
int | gn (int h, int a) |
Compute game numbers. | |
void | init_rrs (void) |
Build a feasible schedule. | |
SportsLeague (const Options &op) | |
SportsLeague (bool share, SportsLeague &s) | |
virtual Space * | copy (bool share) |
Copying member function. | |
virtual void | print (void) |
Protected Member Functions | |
int | digit (int n) |
void | blank (int n) |
void | blankv (int n) |
void | blank_only (int n) |
Constructor & Destructor Documentation
SportsLeague::SportsLeague | ( | const Options & | op | ) | [inline] |
Definition at line 232 of file sports-league.cc.
SportsLeague::SportsLeague | ( | bool | share, | |
SportsLeague & | s | |||
) | [inline] |
Definition at line 355 of file sports-league.cc.
Member Function Documentation
int SportsLeague::digit | ( | int | n | ) | [inline, protected] |
Definition at line 84 of file sports-league.cc.
void SportsLeague::blank | ( | int | n | ) | [inline, protected] |
Definition at line 95 of file sports-league.cc.
void SportsLeague::blankv | ( | int | n | ) | [inline, protected] |
Definition at line 102 of file sports-league.cc.
void SportsLeague::blank_only | ( | int | n | ) | [inline, protected] |
Definition at line 109 of file sports-league.cc.
IntVar& SportsLeague::h | ( | int | p, | |
int | w | |||
) | [inline] |
IntVar& SportsLeague::a | ( | int | p, | |
int | w | |||
) | [inline] |
IntVar& SportsLeague::g | ( | int | p, | |
int | w | |||
) | [inline] |
Access the game number associated with the game in period p and week w.
Definition at line 130 of file sports-league.cc.
Play& SportsLeague::rrs | ( | int | p, | |
int | w | |||
) | [inline] |
Access the entry in the round robin schedule for period p and week w.
Definition at line 138 of file sports-league.cc.
int SportsLeague::gn | ( | int | h, | |
int | a | |||
) | [inline] |
Compute game numbers.
Given the game between a home team
and an away team
this function computes the unique game number
Definition at line 151 of file sports-league.cc.
void SportsLeague::init_rrs | ( | void | ) | [inline] |
Build a feasible schedule.
The games of the first week are fixed as: .
The remaining games are computed by transforming a game from the previous week in a new game
, where:
and
Definition at line 181 of file sports-league.cc.
virtual Space* SportsLeague::copy | ( | bool | share | ) | [inline, virtual] |
Copying member function.
Must create a new object using the constructor for cloning.
Implements Gecode::Space.
Definition at line 366 of file sports-league.cc.
virtual void SportsLeague::print | ( | void | ) | [inline, virtual] |
The documentation for this class was generated from the following file:
- examples/sports-league.cc (Revision: 3517)