44 extern const int*
specs[];
88 int hints =
spec[spos++];
93 for (
int i=hints-1;
i--; spos++)
114 for (
int w=0; w<
width(); w++)
117 for (
int h=0; h<
height(); h++)
123 switch (
opt.branching()) {
140 for (
int w=0; w<
width(); w++) {
141 int hint =
spec[spos++];
142 cols += hint; spos += hint;
144 for (
int h=0; h<
height(); h++) {
145 int hint =
spec[spos++];
146 rows += hint; spos += hint;
150 for (
int w=0; w<
width(); w++)
153 for (
int h=0; h<
height(); h++)
184 for (
int h = 0; h <
height(); ++h) {
186 for (
int w = 0; w <
width(); ++w)
187 os << ((m(w,h).val() == 1) ?
'#' :
' ');
204 "Branch on rows/columns in order");
206 "Use AFC for branching");
209 std::cerr <<
"Error: size must be between 0 and "
213 Script::run<Nonogram,DFS,SizeOptions>(
opt);
488 10, 2,4,2,1,1,1,4,1,1,2,
491 9, 3,3,3,1,1,6,1,1,1,
492 9, 3,2,2,2,2,8,1,1,3,
530 10, 1,1,4,2,1,1,1,1,1,4,
540 9, 1,2,2,2,2,4,1,1,3,
551 13, 2,2,4,9,1,5,1,1,1,1,1,1,1,
555 12, 4,5,3,14,1,1,1,1,4,1,1,3,
556 19, 3,3,2,2,2,4,1,1,1,1,1,1,1,1,3,1,1,3,2,
557 11, 8,2,7,2,1,1,2,1,1,3,3,
558 13, 1,5,9,12,2,1,1,3,1,1,2,2,1,
559 17, 3,2,2,1,1,1,1,4,1,1,1,3,3,1,1,2,2,
560 12, 5,2,2,2,2,1,5,2,1,1,2,5,
561 12, 3,5,9,2,1,1,6,3,1,3,2,3,
562 12, 1,4,1,1,1,4,1,5,5,3,3,3,
563 10, 4,1,1,1,1,3,4,6,6,3,
564 12, 3,1,3,1,1,3,3,1,1,4,6,1,
565 11, 3,1,5,1,1,3,1,1,9,4,1,
566 14, 2,1,1,7,1,4,1,1,1,1,1,1,3,5,
567 11, 9,2,1,3,1,1,1,1,4,2,1,
568 10, 1,14,1,1,2,2,2,10,1,2,
569 10, 1,9,2,1,2,6,1,5,3,2,
570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 11, 1, 7, 3, 2, 2, 2, 2, 2, 1, 1, 1,
1132 9, 6, 5, 2, 2, 2, 2, 6, 1, 1,
1133 10, 3, 2, 2, 2, 2, 2, 2, 4, 1, 1,
1134 9, 1, 2, 2, 2, 2, 2, 2, 13, 1,
1135 9, 1, 2, 2, 2, 2, 2, 2, 1, 2,
1136 7, 1, 2, 2, 2, 2, 2, 16,
1137 6, 3, 2, 2, 2, 2, 3,
1146 7, 1, 2, 2, 2, 2, 2, 1,
1147 7, 4, 2, 2, 4, 2, 2, 4,
1148 7, 4, 2, 2, 4, 2, 2, 4,
1149 7, 1, 2, 2, 2, 2, 2, 1,
1150 7, 6, 2, 2, 2, 2, 2, 6,
1151 7, 6, 2, 2, 2, 2, 2, 6,
1155 8, 1, 1, 2, 1, 1, 2, 1, 1,
1156 6, 9, 2, 2, 2, 2, 9,
1158 6, 1, 1, 1, 1, 1, 1,
1167 7, 1, 1, 1, 4, 1, 1, 1,
1170 7, 1, 2, 1, 2, 1, 2, 1,
1172 7, 1, 1, 6, 2, 6, 1, 1,
1173 9, 1, 1, 1, 1, 2, 1, 1, 1, 1,
1174 7, 1, 1, 6, 2, 6, 1, 1,
1175 6, 1, 1, 5, 5, 1, 1,
1176 7, 1, 1, 1, 8, 1, 1, 1,
1177 6, 1, 1, 4, 4, 1, 1,
const unsigned int n_examples
The number of examples.
const int * specs[]
Board specifications.
Deterministic finite automaton (DFA)
Parametric base-class for scripts.
Matrix-interface for arrays.
Slice< A > col(int c) const
Access column c.
Slice< A > row(int r) const
Access row r.
Regular expressions over integer values.
Options for scripts with additional size parameter
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
int main(int argc, char *argv[])
Main-function.
int width(void) const
Return width of board.
const int difficult[]
Specification for a more difficult picture.
const int heart[]
Specification for a heart-shaped picture.
const int * specs[]
Specification for a heart-shaped picture.
const int webpbn1[]
Dancer.
virtual Space * copy(void)
Copy space during cloning.
const int p200[]
Specification for a picture of cupid.
const int webpbn27[]
Bucks.
@ BRANCH_NONE
Branch on rows/columns in order.
@ BRANCH_AFC
Use AFC for branching.
const int bear[]
Specification for a bear/bunny-shaped picture.
BoolVarArray b
Fields of board.
const int dragonfly[]
Specification for a dragonfly-picture.
int height(void) const
Return height of board.
const int crocodile[]
Specification for a crocodile-shaped picture.
Nonogram(Nonogram &s)
Constructor for cloning s.
const int * spec
Specification to be used.
const int pinwheel[]
Specification for a pinwheel-picture.
virtual void print(std::ostream &os) const
Print solution.
const int webpbn436[]
Petro.
const int castle[]
From http://www.cs.kuleuven.be/~bmd/nonogram.pl.
const int unknown[]
Specification for an unknown picture.
Nonogram(const SizeOptions &opt)
Construction of the model.
const int non_unique[]
Specification for a non-unique picture.
const int webpbn16[]
Knot.
DFA line(int &spos)
Returns next regular expression for line starting from spos.
const int webpbn23[]
Edge.
const int webpbn21[]
Skid.
const int webpbn529[]
Swing.
void parse(int argc, char *argv[])
Parse commandline arguments.
void extensional(Home home, const IntVarArgs &x, DFA d, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for extensional constraint described by a DFA.
void branch(Home home, const IntVarArgs &x, const BoolVarArgs &y, IntBoolVarBranch vars, IntValBranch vals)
Branch function for integer and Boolean variables.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Gecode toplevel namespace
BoolVarBranch BOOL_VAR_NONE(void)
Select first unassigned variable.
BoolValBranch BOOL_VAL_MAX(void)
Select largest value.
BoolVarBranch BOOL_VAR_AFC_MAX(double d=1.0, BranchTbl tbl=nullptr)
Select variable with largest accumulated failure count with decay factor d.
Gecode::IntArgs i({1, 2, 3, 4})