Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
sym-obj.cpp
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Christopher Mears <chris.mears@monash.edu>
5 *
6 * Copyright:
7 * Christopher Mears, 2012
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.org
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 *
32 */
33
34#include <gecode/int/ldsb.hh>
35
36namespace Gecode {
42 : ref(h.ref) {
43 if (ref != NULL)
44 increment();
45 }
46 const SymmetryHandle&
48 if (h.ref == ref)
49 return *this;
50 if (ref != NULL)
51 decrement();
52 ref = h.ref;
53 if (ref != NULL)
54 increment();
55 return *this;
56 }
58 if (ref != NULL)
59 decrement();
60 }
61 void
63 (ref->nrefs)++;
64 }
65 void
67 (ref->nrefs)--;
68 if (ref->nrefs == 0)
69 delete ref;
70 ref = NULL;
71 }
72}
73
74namespace Gecode { namespace Int { namespace LDSB {
75
79
81 nxs = vars.size();
82 xs = new VarImpBase*[nxs];
83 for (int i = 0 ; i < nxs ; i++)
84 xs[i] = vars[i];
85 }
89
92
95 : seq_size(ss) {
96 nxs = x.size();
97 xs = new VarImpBase*[nxs];
98 for (int i = 0 ; i < nxs ; i++)
99 xs[i] = x[i];
100 }
104
107
108}}}
109
110// STATISTICS: int-branch
int size(void) const
Return size of array (number of elements)
Definition array.hpp:1613
Argument array for non-primitive types.
Definition array.hpp:691
Passing integer arguments.
Definition int.hh:634
Integer sets.
Definition int.hh:174
Implementation of a symmetry at the modelling level.
Definition ldsb.hh:106
int nrefs
Number of references that point to this symmetry object.
Definition ldsb.hh:109
SymmetryObject(void)
Default constructor.
Definition sym-obj.cpp:76
virtual ~SymmetryObject(void)
Destructor.
Definition sym-obj.cpp:78
IntArgs values
Array of values in symmetry.
Definition ldsb.hh:153
int seq_size
Size of each sequence in symmetry.
Definition ldsb.hh:155
ValueSequenceSymmetryObject(IntArgs vs, int ss)
Constructor for creation.
Definition sym-obj.cpp:105
IntSet values
Set of symmetric values.
Definition ldsb.hh:131
ValueSymmetryObject(IntSet vs)
Constructor for creation.
Definition sym-obj.cpp:90
int seq_size
Size of each sequence in symmetry.
Definition ldsb.hh:143
int nxs
Number of variables in symmetry.
Definition ldsb.hh:141
VarImpBase ** xs
Array of variables in symmetry.
Definition ldsb.hh:139
VariableSequenceSymmetryObject(ArgArray< VarImpBase * > vars, int ss)
Constructor for creation.
Definition sym-obj.cpp:94
int nxs
Number of variables in symmetry.
Definition ldsb.hh:121
VariableSymmetryObject(ArgArray< VarImpBase * > vars)
Constructor for creation.
Definition sym-obj.cpp:80
VarImpBase ** xs
Array of variables in symmetry.
Definition ldsb.hh:119
A reference-counted pointer to a SymmetryObject.
Definition int.hh:5270
SymmetryHandle(void)
Default constructor.
Definition sym-obj.cpp:37
Int::LDSB::SymmetryObject * ref
Symmetry object that this handle refers to.
Definition int.hh:5273
void decrement(void)
Decrement counter.
Definition sym-obj.cpp:66
const SymmetryHandle & operator=(const SymmetryHandle &h)
Assignment operator.
Definition sym-obj.cpp:47
void increment(void)
Increment counter.
Definition sym-obj.cpp:62
~SymmetryHandle(void)
Destructor.
Definition sym-obj.cpp:57
Base-class for variable implementations.
Definition core.hpp:172
Gecode toplevel namespace
Post propagator for SetVar x
Definition set.hh:773