Generated on Sat Apr 10 2021 00:00:00 for Gecode by doxygen 1.9.1
div.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
6  *
7  * Copyright:
8  * Guido Tack, 2008
9  * Vincent Barichard, 2012
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 
36 namespace Gecode { namespace Float { namespace Arithmetic {
37 
38  /*
39  * Bounds consistent division operator
40  *
41  */
42  template<class A, class B, class C>
44  Div<A,B,C>::Div(Home home, A x0, B x1, C x2)
46 
47  template<class A, class B, class C>
51 
52  template<class A, class B, class C>
53  Actor*
55  return new (home) Div<A,B,C>(home,*this);
56  }
57 
58  template<class A, class B, class C>
60  Div<A,B,C>::post(Home home, A x0, B x1, C x2) {
61  GECODE_ME_CHECK(x2.eq(home,x0.domain() / x1.domain()));
62  GECODE_ME_CHECK(x0.eq(home,x2.domain() * x1.domain()));
63  (void) new (home) Div<A,B,C>(home,x0,x1,x2);
64  return ES_OK;
65  }
66 
67  template<class A, class B, class C>
70  if (x1.assigned() && (x1.val() == 0)) return ES_FAILED;
71  GECODE_ME_CHECK(x2.eq(home,x0.domain() / x1.domain()));
72  GECODE_ME_CHECK(x0.eq(home,x2.domain() * x1.domain()));
73  if (!x2.assigned() || (x2.val() != 0.0))
74  GECODE_ME_CHECK(x1.eq(home,x0.domain() / x2.domain()));
75  return (x0.assigned() && x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_NOFIX;
76  }
77 
78 }}}
79 
80 // STATISTICS: float-prop
81 
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
Base-class for both propagators and branchers.
Definition: core.hpp:628
Propagator for bounds division operator
Definition: arithmetic.hh:300
virtual Actor * copy(Space &home)
Create copy during cloning.
Definition: div.hpp:54
Div(Space &home, Div &p)
Constructor for cloning p.
Definition: div.hpp:49
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: div.hpp:69
static ExecStatus post(Home home, A x0, B x1, C x2)
Post propagator for .
Definition: div.hpp:60
Home class for posting propagators
Definition: core.hpp:856
Mixed ternary propagator.
Definition: pattern.hpp:237
Computation spaces.
Definition: core.hpp:1742
ExecStatus
Definition: core.hpp:472
@ ES_OK
Execution is okay.
Definition: core.hpp:476
@ ES_FAILED
Execution has resulted in failure.
Definition: core.hpp:474
@ ES_NOFIX
Propagation has not computed fixpoint.
Definition: core.hpp:475
ExecStatus ES_SUBSUMED(Propagator &p)
Definition: core.hpp:3563
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition: macros.hpp:52
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
Definition: var-type.hpp:292
#define forceinline
Definition: config.hpp:192