1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Gereon Kremer |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
8 |
|
* in the top-level source directory and their institutional affiliations. |
9 |
|
* All rights reserved. See the file COPYING in the top-level source |
10 |
|
* directory for licensing information. |
11 |
|
* **************************************************************************** |
12 |
|
* |
13 |
|
* Represents a contraction candidate for ICP-style propagation. |
14 |
|
*/ |
15 |
|
|
16 |
|
#ifndef CVC5__THEORY__ARITH__ICP__CANDIDATE_H |
17 |
|
#define CVC5__THEORY__ARITH__ICP__CANDIDATE_H |
18 |
|
|
19 |
|
#include "cvc5_private.h" |
20 |
|
|
21 |
|
#ifdef CVC5_POLY_IMP |
22 |
|
#include <poly/polyxx.h> |
23 |
|
|
24 |
|
#include "expr/node.h" |
25 |
|
#include "theory/arith/nl/icp/intersection.h" |
26 |
|
|
27 |
|
namespace cvc5 { |
28 |
|
namespace theory { |
29 |
|
namespace arith { |
30 |
|
namespace nl { |
31 |
|
namespace icp { |
32 |
|
|
33 |
|
/** |
34 |
|
* A contraction candidate for ICP-style propagation with the following |
35 |
|
* semantics: |
36 |
|
* |
37 |
|
* lhs ~rel~ rhsmult*rhs |
38 |
|
* |
39 |
|
* where lhs is the variable whose interval we aim to contract, rel is a |
40 |
|
* relation symbol (other than disequality), rhsmult is a fractional constant |
41 |
|
* and rhs a polynomial. As poly::Polynomial only holds integer polynomials, |
42 |
|
* rhsmult is necessary to encode polynomials with rational coefficients. |
43 |
|
* |
44 |
|
* Additionally, we store the origin of this constraints (a single theory |
45 |
|
* constraint) and the variables contained in rhs. |
46 |
|
* |
47 |
|
* A candidate is evaluated (or propagated) by evaluating the rhsmult*rhs over |
48 |
|
* an interval assignment and then updating the interval assignment for lhs with |
49 |
|
* the result of this evaluation, properly considering the relation. |
50 |
|
*/ |
51 |
314 |
struct Candidate |
52 |
|
{ |
53 |
|
/** The target variable */ |
54 |
|
poly::Variable lhs; |
55 |
|
/** The relation symbol */ |
56 |
|
poly::SignCondition rel; |
57 |
|
/** The (integer) polynomial on the right hand side */ |
58 |
|
poly::Polynomial rhs; |
59 |
|
/** The rational multiplier */ |
60 |
|
poly::Rational rhsmult; |
61 |
|
/** The origin of this candidate */ |
62 |
|
Node origin; |
63 |
|
/** The variable within rhs */ |
64 |
|
std::vector<Node> rhsVariables; |
65 |
|
|
66 |
|
/** |
67 |
|
* Contract the interval assignment based on this candidate. |
68 |
|
* Only contract if the new interval is below the given threshold, see |
69 |
|
* intersect_interval_with(). |
70 |
|
*/ |
71 |
|
PropagationResult propagate(poly::IntervalAssignment& ia, |
72 |
|
std::size_t size_threshold) const; |
73 |
|
}; |
74 |
|
|
75 |
|
/** Print a candidate. */ |
76 |
|
std::ostream& operator<<(std::ostream& os, const Candidate& c); |
77 |
|
|
78 |
|
} // namespace icp |
79 |
|
} // namespace nl |
80 |
|
} // namespace arith |
81 |
|
} // namespace theory |
82 |
|
} // namespace cvc5 |
83 |
|
|
84 |
|
#endif |
85 |
|
|
86 |
|
#endif |