MCPcopy Create free account
hub / github.com/Gecode/gecode / post

Method post

test/float/mm-lin.cpp:161–190  ·  view source on GitHub ↗

Post constraint on \a x

Source from the content-addressed store, hash-verified

159 }
160 /// Post constraint on \a x
161 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
162 using namespace Gecode;
163 FloatVarArray y(home,3,dom.min(),dom.max());
164 channel(home, x[0], y[0]);
165 channel(home, x[1], y[1]);
166 channel(home, x[2], y[2]);
167 LinFloatExpr l_reg[3] = {y[0],y[1],y[2]};
168 LinFloatExpr r_reg[3] = {y[0],y[1],y[2]};
169 switch (frt) {
170 case FRT_EQ:
171 Gecode::rel(home, eval(l_lis,l_reg) == eval(r_lis,r_reg));
172 break;
173 case FRT_NQ:
174 Gecode::rel(home, eval(l_lis,l_reg) != eval(r_lis,r_reg));
175 break;
176 case FRT_LQ:
177 Gecode::rel(home, eval(l_lis,l_reg) <= eval(r_lis,r_reg));
178 break;
179 case FRT_LE:
180 Gecode::rel(home, eval(l_lis,l_reg) < eval(r_lis,r_reg));
181 break;
182 case FRT_GQ:
183 Gecode::rel(home, eval(l_lis,l_reg) >= eval(r_lis,r_reg));
184 break;
185 case FRT_GR:
186 Gecode::rel(home, eval(l_lis,l_reg) > eval(r_lis,r_reg));
187 break;
188 default: GECODE_NEVER;
189 }
190 }
191 };
192
193 const LinInstr li000[] = {

Callers

nothing calls this directly

Calls 5

evalFunction · 0.70
channelFunction · 0.50
relFunction · 0.50
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected