LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/arith/nl/ext - constraint.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2025-02-07 15:41:26 Functions: 1 1 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Andrew Reynolds, Aina Niemetz, Gereon Kremer
       4                 :            :  *
       5                 :            :  * This file is part of the cvc5 project.
       6                 :            :  *
       7                 :            :  * Copyright (c) 2009-2025 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                 :            :  * Utilities for non-linear constraints.
      14                 :            :  */
      15                 :            : 
      16                 :            : #ifndef CVC5__THEORY__ARITH__NL__EXT__CONSTRAINT_H
      17                 :            : #define CVC5__THEORY__ARITH__NL__EXT__CONSTRAINT_H
      18                 :            : 
      19                 :            : #include <map>
      20                 :            : #include <vector>
      21                 :            : 
      22                 :            : #include "expr/kind.h"
      23                 :            : #include "expr/node.h"
      24                 :            : 
      25                 :            : namespace cvc5::internal {
      26                 :            : namespace theory {
      27                 :            : namespace arith {
      28                 :            : namespace nl {
      29                 :            : 
      30                 :            : class MonomialDb;
      31                 :            : 
      32                 :            : /** constraint information
      33                 :            :  *
      34                 :            :  * The struct ( d_rhs, d_coeff, d_type ) represents that a literal is of the
      35                 :            :  * form (d_coeff * x) <d_type> d_rhs.
      36                 :            :  */
      37                 :            : struct ConstraintInfo
      38                 :            : {
      39                 :            :  public:
      40                 :            :   /** The term on the right hand side of the constraint */
      41                 :            :   Node d_rhs;
      42                 :            :   /** The coefficent */
      43                 :            :   Node d_coeff;
      44                 :            :   /** The type (relation) of the constraint */
      45                 :            :   Kind d_type;
      46                 :            : }; /* struct ConstraintInfo */
      47                 :            : 
      48                 :            : /** A database for constraints */
      49                 :            : class ConstraintDb
      50                 :            : {
      51                 :            :  public:
      52                 :            :   ConstraintDb(MonomialDb& mdb);
      53                 :      32596 :   ~ConstraintDb() {}
      54                 :            :   /** register constraint
      55                 :            :    *
      56                 :            :    * This ensures that atom is in the domain of the constraints maintained by
      57                 :            :    * this database.
      58                 :            :    */
      59                 :            :   void registerConstraint(Node atom);
      60                 :            :   /** get constraints
      61                 :            :    *
      62                 :            :    * Returns a map m such that whenever
      63                 :            :    * m[lit][x] = ( r, coeff, k ), then
      64                 :            :    * ( lit <=>  (coeff * x) <k> r )
      65                 :            :    */
      66                 :            :   const std::map<Node, std::map<Node, ConstraintInfo> >& getConstraints();
      67                 :            :   /** Returns true if m is of maximal degree in atom
      68                 :            :    *
      69                 :            :    * For example, for atom x^2 + x*y + y >=0, the monomials x^2 and x*y
      70                 :            :    * are of maximal degree (2).
      71                 :            :    */
      72                 :            :   bool isMaximal(Node atom, Node m) const;
      73                 :            : 
      74                 :            :  private:
      75                 :            :   /** Reference to a monomial database */
      76                 :            :   MonomialDb& d_mdb;
      77                 :            :   /** List of all constraints */
      78                 :            :   std::vector<Node> d_constraints;
      79                 :            :   /** Is maximal degree */
      80                 :            :   std::map<Node, std::map<Node, bool> > d_c_info_maxm;
      81                 :            :   /** Constraint information */
      82                 :            :   std::map<Node, std::map<Node, ConstraintInfo> > d_c_info;
      83                 :            : };
      84                 :            : 
      85                 :            : }  // namespace nl
      86                 :            : }  // namespace arith
      87                 :            : }  // namespace theory
      88                 :            : }  // namespace cvc5::internal
      89                 :            : 
      90                 :            : #endif /* CVC5__THEORY__ARITH__NL_SOLVER_H */

Generated by: LCOV version 1.14