44 using namespace Gecode;
56 b = (
v*(
v-1)*lambda)/(k*(k-1));
57 r = (lambda*(
v-1)) / (k-1);
61 int v0,
int k0,
int lambda0)
62 :
Options(s),
v(v0), k(k0), lambda(lambda0) {
66 void parse(
int& argc,
char* argv[]) {
72 lambda = atoi(argv[3]);
78 std::cerr <<
"\t(unsigned int) default: " <<
v << std::endl
79 <<
"\t\tparameter v" << std::endl
80 <<
"\t(unsigned int) default: " << k << std::endl
81 <<
"\t\tparameter k" << std::endl
82 <<
"\t(unsigned int) default: " << lambda << std::endl
83 <<
"\t\tparameter lambda" << std::endl;
116 for (
int i=0;
i<
opt.v;
i++)
120 for (
int j=0; j<
opt.b; j++)
124 for (
int i1=0; i1<
opt.v; i1++)
125 for (
int i2=i1+1; i2<
opt.v; i2++) {
127 for (
int j=0; j<
opt.b; j++)
128 row[j] =
expr(*
this,
p(j,i1) &&
p(j,i2));
137 if (
opt.symmetry() == SYMMETRY_LDSB) {
143 if (
opt.symmetry() == SYMMETRY_LEX) {
144 for (
int i=1;
i<
opt.v;
i++)
146 for (
int j=1; j<
opt.b; j++)
158 <<
opt.v <<
"," <<
opt.k <<
","
159 <<
opt.lambda <<
")" << std::endl;
161 for (
int i = 0;
i<
opt.v;
i++) {
163 for (
int j = 0; j<
opt.b; j++)
173 _p.update(*
this,share,s.
_p);
179 return new BIBD(share,*
this);
196 opt.
parse(argc,argv);
203 Script::run<BIBD,DFS,BIBDOptions>(
opt);
int r
Derived parameters Derive additional parameters
Options for BIBD problems
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatNum c)
Post propagator for .
virtual void help(void)
Print help message.
BIBD(const BIBDOptions &o)
Actual model.
Collection of symmetries.
SymmetryHandle columns_interchange(const Matrix< A > &m)
Interchangeable columns symmetry specification.
Parametric base-class for scripts.
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual Space * copy(bool share)
Copy during cloning.
Lex-constraints on rows/columns.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
const BIBDOptions & opt
Options providing access to parameters.
BoolVarArray _p
Matrix of Boolean variables.
Slice< A > row(int r) const
Access row r.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Example: Balanced incomplete block design (BIBD)
struct Gecode::@512::NNF::@54::@55 b
For binary nodes (and, or, eqv)
Passing Boolean variables.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
int main(int argc, char *argv[])
Main-function.
BoolVar expr(Home home, const BoolExpr &e, IntConLevel icl)
Post Boolean expression and return its value.
void symmetry(int v)
Set default symmetry value.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
SymmetryHandle rows_interchange(const Matrix< A > &m)
Interchangeable rows symmetry specification.
virtual void print(std::ostream &os) const
Print solution.
BIBD(bool share, BIBD &s)
Constructor for cloning s.
Matrix-interface for arrays.
Slice< A > col(int c) const
Access column c.
BrancherHandle branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf, FloatVarValPrint vvp)
Branch over x with variable selection vars and value selection vals.
BIBDOptions(const char *s, int v0, int k0, int lambda0)
Initialize options for example with name s.
virtual void help(void)
Print help text.