73 int gn(
int h,
int a)
const {
120 for (
int w=1; w<
weeks(); w++) {
124 else if (
play(
p,w-1).h == 1)
227 for (
int w=0; w<
weeks(); w++) {
244 for (
int w=0; w<
teams; w++)
260 for (
int w=0; w<
teams; w++) {
263 c[2*
p] =
h(
p,w); c[2*
p+1] =
a(
p,w);
276 for (
int i=1; i<=
teams; i++)
283 for (
int w=0; w<
weeks(); w ++)
303 virtual void print(std::ostream& os)
const {
313 for (
int w=0; w<
weeks(); w++) {
319 os <<
h(
p,w).
val() <<
'-';
321 os <<
a(
p,w).val() <<
" ";
337 opt.
parse(argc,argv);
338 if (opt.size() < 5) {
339 std::cerr<<
"No Solution for less than 5 teams!" << std::endl;
342 if (opt.size() % 2 != 0) {
343 std::cerr <<
"Number of teams has to be even!" << std::endl;
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Parametric base-class for scripts.
static void run(const Options &opt, Script *s=NULL)
Passing integer arguments.
Passing integer variables.
int val(void) const
Return assigned value.
Options for scripts with additional size parameter
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
Entry in round robin schedule.
int g
game number Default constructor
void hag(int w, IntArgs &h, IntArgs &a, IntArgs &g)
Home, away, and game information.
RRS(int t)
Build a feasible schedule.
const int teams
Number of teams.
Play & play(int p, int w)
Play for period p and week w.
int weeks(void) const
Return number of weeks.
~RRS(void)
Delete schedule.
int gn(int h, int a) const
Game number for game between home team h and away team a.
Play * plays
Play information.
int periods(void) const
Return number of periods.
Example: Sports league scheduling
IntVar & a(int p, int w)
Away team in period p and week w.
int main(int argc, char *argv[])
Main-function.
int weeks(void) const
Return number of weeks.
SportsLeague(const SizeOptions &opt)
Setup model.
virtual Space * copy(void)
Copy during cloning.
virtual void print(std::ostream &os) const
Print solution.
const IntVar & h(int p, int w) const
Home team in period p and week w.
SportsLeague(SportsLeague &s)
Constructor for cloning s.
IntVar & g(int p, int w)
Return game number for game in period p and week w.
int periods(void) const
Return number of periods.
const IntVar & a(int p, int w) const
Away team in period p and week w.
IntVar & h(int p, int w)
Home team 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.
const int teams
number of teams
IntVarArray away
away teams
IntVarArray game
game numbers
IntVarArray home
home teams
void parse(int argc, char *argv[])
Parse commandline arguments.
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Branch over x with variable selection vars and value selection vals.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
Gecode toplevel namespace
IntValBranch INT_VAL_SPLIT_MIN(void)
Select values not greater than mean of smallest and largest value.
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel ipl=IPL_DEF)
Post propagator for .
Post propagator for SetVar SetOpType SetVar SetRelType r
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl=IPL_DEF)
Post propagator for for all .
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
void element(Home home, IntSharedArray n, IntVar x0, IntVar x1, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for .
void values(Home home, const IntVarArgs &x, IntSet y, IntPropLevel ipl=IPL_DEF)
Post constraint .