Generated on Thu Jan 31 2019 20:56:32 for Gecode by doxygen 1.8.15
channel.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
6  *
7  * Copyright:
8  * Christian Schulte, 2004
9  * Vincent Barichard, 2012
10  *
11  * Last modified:
12  * $Date: 2017-04-10 13:21:37 +0200 (Mon, 10 Apr 2017) $ by $Author: schulte $
13  * $Revision: 15631 $
14  *
15  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
40 namespace Gecode { namespace Float { namespace Channel {
41 
42  template<class A, class B>
44  Channel<A,B>::Channel(Home home, A x0, B x1)
45  : MixBinaryPropagator<A,PC_FLOAT_BND,B,Int::PC_INT_BND>(home,x0,x1) {}
46 
47  template<class A, class B>
50  : MixBinaryPropagator<A,PC_FLOAT_BND,B,Int::PC_INT_BND>(home,share,p) {}
51 
52  template<class A, class B>
53  Actor*
54  Channel<A,B>::copy(Space& home, bool share) {
55  return new (home) Channel<A,B>(home,share,*this);
56  }
57 
58  template<class A, class B>
60  Channel<A,B>::post(Home home, A x0, B x1) {
63  (void) new (home) Channel<A,B>(home,x0,x1);
64  return ES_OK;
65  }
66 
67  template<class A, class B>
70  GECODE_ME_CHECK(x1.gq(home,static_cast<int>(std::ceil(x0.min()))));
71  GECODE_ME_CHECK(x1.lq(home,static_cast<int>(std::floor(x0.max()))));
72  GECODE_ME_CHECK(x0.eq(home,FloatVal(x1.min(),x1.max())));
73  return x0.assigned() ? home.ES_SUBSUMED(*this) : ES_FIX;
74  }
75 
76 }}}
77 
78 // STATISTICS: float-prop
79 
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
Definition: post.cpp:228
ExecStatus ES_SUBSUMED(Propagator &p)
Definition: core.hpp:3614
Propagation has computed fixpoint.
Definition: core.hpp:545
const int max
Largest allowed integer value.
Definition: int.hh:116
Computation spaces.
Definition: core.hpp:1748
const int min
Smallest allowed integer value.
Definition: int.hh:118
Base-class for both propagators and branchers.
Definition: core.hpp:696
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Propagator for bounds consistent integer part operator
Definition: channel.hh:62
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
Definition: var-type.hpp:91
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition: macros.hpp:56
Float value type.
Definition: float.hh:338
Mixed binary propagator.
Definition: propagator.hpp:213
ExecStatus
Definition: core.hpp:540
#define forceinline
Definition: config.hpp:173
Execution is okay.
Definition: core.hpp:544
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
Definition: var-type.hpp:292
Gecode toplevel namespace
int ModEventDelta
Modification event deltas.
Definition: core.hpp:169
Home class for posting propagators
Definition: core.hpp:922