60 int v0 = 5,
int q0 = 3,
int lambda0 = 2,
int d0 = 4)
62 _v(
"v",
"number of sequences", v0 ),
63 _q(
"q",
"number of symbols", q0 ),
64 _l(
"l",
"sets of symbols per sequence (lambda)", lambda0),
65 _d(
"d",
"Hamming distance between sequences", d0 ),
66 _permutation(
"permutation",
"use permutation constraints if d=4",
78 _permutation.
add(
true,
"full" );
79 _permutation.
add(
false,
"none");
81 _symmetry.add(
true,
"true" );
82 _symmetry.add(
false,
"false");
85 void parse(
int& argc,
char* argv[]) {
89 int v(
void)
const {
return _v.
value(); }
91 int q(
void)
const {
return _q.
value(); }
93 int l(
void)
const {
return _l.
value(); }
95 int d(
void)
const {
return _d.
value(); }
100 bool symmetry(
void)
const {
return _symmetry.value(); }
138 nseqpair((v*(v-1))/2),
140 diff(*this, n*nseqpair, 0, 1)
151 for (
int i = q;
i--; ) values[
i] =
i+1;
153 for (
int i = v;
i--; )
160 for (
int a = 0;
a <
v; ++
a) {
161 for (
int b =
a+1;
b <
v; ++
b) {
162 for (
int i = n;
i--; ) {
168 assert(nseqi == nseqpair);
173 for (
int i = nseqpair;
i--; ) {
182 for (
int r = 0;
r<v-1; ++
r) {
186 for (
int c = 0; c<n-1; ++
c) {
192 for (
int c = 0; c <
n; ++
c) {
209 for (
int r1 = 0; r1 <
v; ++r1) {
210 for (
int r2 = r1+1; r2 <
v; ++r2) {
215 for (
int i = d;
i--; ) perm[
i] =
IntVar(*
this, 0, n-1);
217 IntVar cform(*
this, 0, 1);
223 for (
int i = 2*d;
i--; ) _p[
i] =
IntVar(*
this, 1, q);
225 for (
int i = 0;
i < 2; ++
i) {
226 for (
int j = 0; j <
d; ++j) {
232 for (
int i = 0;
i <
d; ++
i) {
233 IntVar index(*
this, 0, 2*d);
234 rel(*
this, cform*d +
i == index);
235 IntVar value(*
this, 1, q);
236 element(*
this, _p, index, value);
237 element(*
this, row2, perm[
i], value);
250 for (
int i = n;
i--; ) {
253 rel(*
this, (!p1b[
i] && !p2b[
i] && !p3b[
i] && !p4b[
i]) ==
254 (row1[i] == row2[i]));
263 rel(*
this, perm[0],
IRT_NQ, perm[2], cformb);
264 rel(*
this, perm[0],
IRT_NQ, perm[3], cformb);
265 rel(*
this, perm[1],
IRT_NQ, perm[2], cformb);
266 rel(*
this, perm[1],
IRT_NQ, perm[3], cformb);
272 rel(*
this, (!cformb) >> (perm[2] < perm[3]));
284 for (
int i = 0;
i <
v; ++
i) {
286 os << r << std::endl;
307 return new EFPA(*
this);
318 opt.
parse(argc,argv);
320 Script::run<EFPA,DFS,EFPAOptions>(
opt);
void value(int v)
Set default value to v.
EFPAOptions(const char *s, int v0=5, int q0=3, int lambda0=2, int d0=4)
Initialize options for example with name s.
IntVarBranch INT_VAR_NONE(void)
Select first unassigned variable.
Slice< A > col(int c) const
Access column c.
int v
Number of sequences.
void 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.
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel)
Post propagator for .
int q(void) const
Get q, number of symbols.
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
void add(int v, const char *o, const char *h=NULL)
Add option value for value v, string o, and help text h.
EFPA(EFPA &s)
Constructor for cloning s.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
bool permutation(void) const
Whether to use permutation constraints. Only active if d=4.
int d
Hamming distance between any pair of sequences.
void ipl(IntPropLevel i)
Set default integer propagation level.
EFPA(const EFPAOptions &opt)
Actual model.
bool symmetry(void) const
Whether to use symmetry breaking.
Parametric base-class for scripts.
void value(unsigned int v)
Set default value to v.
int v(void) const
Get v, number of sequences.
IntVarArray c
Variables for sequences.
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Multi _d(Gecode::IntArgs(3, 3, 2, 1))
int n
Length of sequence ( )
virtual void print(std::ostream &os) const
Print instance and solution.
IntRelType
Relation types for integers.
virtual Space * copy(void)
Copy during cloning.
IntValBranch INT_VAL_MIN(void)
Select smallest value.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
Passing integer variables.
int d(void) const
Get d, Hamming distance between sequences.
Passing integer arguments.
Passing Boolean variables.
Boolean integer variables.
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
Post propagator for SetVar SetOpType SetVar SetRelType r
BoolVarArray diff
Differences between sequences.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
String-valued option (integer value defined by strings)
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
int l(void) const
Get lambda, sets of symbols per sequence.
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
Slice< A > row(int r) const
Access row r.
Example: Equidistant Frequency Permutation Arrays
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Domain propagation Options: basic versus advanced propagation.
void values(Home home, const IntVarArgs &x, IntSet y, IntPropLevel ipl=IPL_DEF)
Post constraint .
Matrix-interface for arrays.
int main(int argc, char *argv[])
Main-function.
Gecode toplevel namespace
int nseqpair
Number of sequence pairs ( )
Options for EFPA problems
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntPropLevel)
Post domain consistent propagator for .
int l
Number of sets of symbols for a sequence ( )