SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
level_covering.h
Go to the documentation of this file.
1 #include "unsat_intervals.h"
2 
4 
5 /**
6  * Computes an unsat covering w.r.t. a set of constraints.
7  *
8  * If a constraint is univariate under a sample, for the unassinged variables, the constraint induces intervals in which the constraint will be conflicting. If multiple such intervals from a set of constraints cover the real line, then the partial sample cannot be extended without making a conflict. This conflict is generalized.
9  *
10  * @param constraints Atoms of the same level such that @ref sample cannot be extended for the highest variable without making one atom false. Note that this property is not checked.
11  * @param sample A sample such that all but the highest variable in @ref constraints are assigned.
12  * @return A sampled derivation which contains the information to reproduce the conflict.
13  */
14 template<typename op, representation::CoveringHeuristic covering_heuristic>
15 std::optional<datastructures::SampledDerivationRef<typename op::PropertiesSet>> get_level_covering(datastructures::Projections& proj, const std::vector<Atom>& constraints, const Assignment& sample) {
16  SMTRAT_LOG_FUNC("smtrat.cadcells.algorithms.onecell", constraints << ", " << sample);
17  std::vector<datastructures::SampledDerivationRef<typename op::PropertiesSet>> unsat_cells;
18  for (const auto& c : constraints) {
19  auto intervals = get_unsat_intervals<op>(c, proj, sample);
20  unsat_cells.insert(unsat_cells.end(), intervals.begin(), intervals.end());
21  }
22 
23  SMTRAT_LOG_TRACE("smtrat.cadcells.algorithms.onecell", "Computing covering representation");
24  auto covering_repr = representation::covering<covering_heuristic>::compute(unsat_cells);
25  SMTRAT_LOG_TRACE("smtrat.cadcells.algorithms.onecell", "Got representation " << covering_repr);
26 
27  SMTRAT_LOG_TRACE("smtrat.cadcells.algorithms.onecell", "Compute covering projection");
28  auto cell_derivs = covering_repr.sampled_derivations();
30  if (!op::project_covering_properties(covering_repr)) return std::nullopt;
31 
32  return covering_repr.cells.front().derivation->underlying().sampled_ref();
33 }
34 
35 }
Encapsulates all computations on polynomials.
Definition: projections.h:46
Various algorithms as well as helper functions for developing new algorithms.
Definition: interval.h:5
std::optional< datastructures::SampledDerivationRef< typename op::PropertiesSet > > get_level_covering(datastructures::Projections &proj, const std::vector< Atom > &constraints, const Assignment &sample)
Computes an unsat covering w.r.t.
void merge_underlying(std::vector< SampledDerivationRef< Properties >> &derivations)
Merges the underlying derivations of a set of sampled derivations.
Definition: derivation.h:408
carl::Assignment< RAN > Assignment
Definition: common.h:25
#define SMTRAT_LOG_TRACE(channel, msg)
Definition: logging.h:36
#define SMTRAT_LOG_FUNC(channel, args)
Definition: logging.h:38
static datastructures::CoveringRepresentation< T > compute(const std::vector< datastructures::SampledDerivationRef< T >> &ders)