this repo has no description
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2/* 3 * Main author: 4 * Christian Schulte <schulte@gecode.org> 5 * Guido Tack <tack@gecode.org> 6 * 7 * Copyright: 8 * Christian Schulte, 2018 9 * Guido Tack, 2018 10 * 11 * This file is part of Gecode, the generic constraint 12 * development environment: 13 * http://www.gecode.org 14 * 15 * Permission is hereby granted, free of charge, to any person obtaining 16 * a copy of this software and associated documentation files (the 17 * "Software"), to deal in the Software without restriction, including 18 * without limitation the rights to use, copy, modify, merge, publish, 19 * distribute, sublicense, and/or sell copies of the Software, and to 20 * permit persons to whom the Software is furnished to do so, subject to 21 * the following conditions: 22 * 23 * The above copyright notice and this permission notice shall be 24 * included in all copies or substantial portions of the Software. 25 * 26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 30 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 31 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 32 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 33 * 34 */ 35 36namespace Gecode { 37 38 inline void 39 atmost(Home home, const IntVarArgs& x, int n, int m, 40 IntPropLevel ipl) { 41 count(home,x,n,IRT_LQ,m,ipl); 42 } 43 inline void 44 atmost(Home home, const IntVarArgs& x, IntVar y, int m, 45 IntPropLevel ipl) { 46 count(home,x,y,IRT_LQ,m,ipl); 47 } 48 inline void 49 atmost(Home home, const IntVarArgs& x, const IntArgs& y, int m, 50 IntPropLevel ipl) { 51 count(home,x,y,IRT_LQ,m,ipl); 52 } 53 inline void 54 atmost(Home home, const IntVarArgs& x, int n, IntVar z, 55 IntPropLevel ipl) { 56 count(home,x,n,IRT_LQ,z,ipl); 57 } 58 inline void 59 atmost(Home home, const IntVarArgs& x, IntVar y, IntVar z, 60 IntPropLevel ipl) { 61 count(home,x,y,IRT_LQ,z,ipl); 62 } 63 inline void 64 atmost(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z, 65 IntPropLevel ipl) { 66 count(home,x,y,IRT_LQ,z,ipl); 67 } 68 69 inline void 70 atleast(Home home, const IntVarArgs& x, int n, int m, 71 IntPropLevel ipl) { 72 count(home,x,n,IRT_GQ,m,ipl); 73 } 74 inline void 75 atleast(Home home, const IntVarArgs& x, IntVar y, int m, 76 IntPropLevel ipl) { 77 count(home,x,y,IRT_GQ,m,ipl); 78 } 79 inline void 80 atleast(Home home, const IntVarArgs& x, const IntArgs& y, int m, 81 IntPropLevel ipl) { 82 count(home,x,y,IRT_GQ,m,ipl); 83 } 84 inline void 85 atleast(Home home, const IntVarArgs& x, int n, IntVar z, 86 IntPropLevel ipl) { 87 count(home,x,n,IRT_GQ,z,ipl); 88 } 89 inline void 90 atleast(Home home, const IntVarArgs& x, IntVar y, IntVar z, 91 IntPropLevel ipl) { 92 count(home,x,y,IRT_GQ,z,ipl); 93 } 94 inline void 95 atleast(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z, 96 IntPropLevel ipl) { 97 count(home,x,y,IRT_GQ,z,ipl); 98 } 99 100 inline void 101 exactly(Home home, const IntVarArgs& x, int n, int m, 102 IntPropLevel ipl) { 103 count(home,x,n,IRT_EQ,m,ipl); 104 } 105 inline void 106 exactly(Home home, const IntVarArgs& x, IntVar y, int m, 107 IntPropLevel ipl) { 108 count(home,x,y,IRT_EQ,m,ipl); 109 } 110 inline void 111 exactly(Home home, const IntVarArgs& x, const IntArgs& y, int m, 112 IntPropLevel ipl) { 113 count(home,x,y,IRT_EQ,m,ipl); 114 } 115 inline void 116 exactly(Home home, const IntVarArgs& x, int n, IntVar z, 117 IntPropLevel ipl) { 118 count(home,x,n,IRT_EQ,z,ipl); 119 } 120 inline void 121 exactly(Home home, const IntVarArgs& x, IntVar y, IntVar z, 122 IntPropLevel ipl) { 123 count(home,x,y,IRT_EQ,z,ipl); 124 } 125 inline void 126 exactly(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z, 127 IntPropLevel ipl) { 128 count(home,x,y,IRT_EQ,z,ipl); 129 } 130 131 inline void 132 lex(Home home, const IntVarArgs& x, IntRelType r, const IntVarArgs& y, 133 IntPropLevel ipl) { 134 rel(home,x,r,y,ipl); 135 } 136 inline void 137 lex(Home home, const BoolVarArgs& x, IntRelType r, const BoolVarArgs& y, 138 IntPropLevel ipl) { 139 rel(home,x,r,y,ipl); 140 } 141 142 inline void 143 values(Home home, const IntVarArgs& x, IntSet y, 144 IntPropLevel ipl) { 145 dom(home,x,y,ipl); 146 nvalues(home,x,IRT_EQ,static_cast<int>(y.size()),ipl); 147 } 148 149#ifdef GECODE_HAS_SET_VARS 150 151 inline void 152 channel(Home home, const IntVarArgs& x, SetVar y) { 153 rel(home,SOT_UNION,x,y); 154 nvalues(home,x,IRT_EQ,expr(home,cardinality(y))); 155 } 156 157 inline void 158 range(Home home, const IntVarArgs& x, SetVar y, SetVar z) { 159 element(home,SOT_UNION,x,y,z); 160 } 161 162 inline void 163 roots(Home home, const IntVarArgs& x, SetVar y, SetVar z) { 164 SetVarArgs xiv(home,z.lubMax()+1,IntSet::empty,0,x.size()-1); 165 channel(home,x,xiv); 166 element(home,SOT_UNION,xiv,z,y); 167 } 168 169#endif 170 171} 172 173// STATISTICS: minimodel-any 174