11 for (std::size_t pos = evalWith.find_first(); pos != carl::Bitset::npos; pos = evalWith.find_next(pos)) {
13 mData[pos].set(sid,
true);
19 assert(
mData.size() > 0);
20 std::size_t maxID = 0;
21 std::size_t maxDegree = 0;
22 for (std::size_t
id = 0;
id <
mData.size();
id++) {
23 std::size_t deg =
mData[id].count();
24 if (deg > maxDegree) {
33 assert(
mData.size() >
id);
34 carl::Bitset selection =
mData[id];
41 std::vector<std::size_t> res;
42 for (std::size_t sample = 0; sample <
numSamples(); sample++){
43 std::size_t numConflicts = 0;
44 std::size_t essentialConstraint = 0;
45 for(std::size_t constraint = 0; constraint <
mData.size(); constraint++){
46 if(
mData[constraint].test(sample)) {
48 essentialConstraint = constraint;
51 if(numConflicts == 1){
53 res.push_back(essentialConstraint);
64 std::set<std::vector<uint8_t>> uniqueColumns;
66 std::vector<uint8_t> column (
mData.size(), 0);
67 for(std::size_t constraint = 0; constraint <
mData.size(); constraint++){
68 column[constraint] =
mData[constraint].test(s);
70 uniqueColumns.insert(column);
73 for(
auto& b : res.
mData){
74 b.resize(uniqueColumns.size());
77 for(
auto column : uniqueColumns){
78 for(std::size_t row = 0; row <
mData.size(); row++){
79 res.
mData[row].set(sid, column[row]);
90 for (
const auto& d:
mData) {
91 if (d.any())
return true;
99 res = std::max(res, c.size());
106 for(
auto& c :
mData){
117 carl::Bitset mask(0);
118 std::vector<std::size_t> ids;
119 for (std::size_t
id = 0;
id <
mData.size();
id++) {
120 if (
mData[
id].any()){
125 std::vector<std::pair<std::size_t, carl::Bitset>> res;
127 assert(
mData[
id].size() == mask.size());
128 res.push_back(std::pair<std::size_t, carl::Bitset>(
id,
mData[
id] | ~mask));
134 os <<
"Print CG with " << cg.
mData.size() <<
" constraints" << std::endl;
135 std::size_t numSamples = 0;
136 for (
auto c : cg.
mData){
137 numSamples = std::max(numSamples, c.size());
139 for (std::size_t i = 0; i < cg.
mData.size(); i++) {
140 if(cg.
mData[i].any()){
142 std::string(numSamples-cg.
mData[i].size(),
'0') << cg.
mData[i] <<
143 " : " << cg.
mData[i].count() << std::endl;
Representation of a bipartite graph (C+S, E) of vertices C and S, representing the constraints and sa...
ConflictGraph removeDuplicateColumns()
Returns a new ConflictGraph whose adjacency matrix consists only of the unique columns of the adjacen...
std::vector< std::pair< std::size_t, carl::Bitset > > getRemainingConstraints()
std::vector< size_t > selectEssentialConstraints()
Selects all essential constraints and returns their indices.
std::size_t numSamples() const
std::vector< carl::Bitset > mData
Stores for each constraints, which sample points violate the constraint.
void addSample(const Sample &sample)
bool hasRemainingSamples() const
Checks if there are samples still uncovered.
carl::Bitset getData(std::size_t id)
void selectConstraint(std::size_t id)
Removes the given constraint and disable all sample points covered by this constraint.
std::size_t numRemainingConstraints() const
std::size_t getMaxDegreeConstraint() const
Retrieves the constraint that covers the most samples.
const carl::Bitset & evaluatedWith() const
const carl::Bitset & evaluationResult() const
bool hasConflictWithConstraint() const
std::ostream & operator<<(std::ostream &os, const SampleIteratorQueue< I, C > &siq)
Class to create the formulas for axioms.