-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description This PR was born out of frustration with the implementation of the `LogicBlocks` library as well as the fact that maintaining it as a submodule has lots of disadvantages (no shared CMake configuration) for little to no benefits. So this PR does two things: - it eliminates the `LogicBlocks` submodule completely and instead vendors the code directly as part of QMAP. - it significantly refactors and strips down the corresponding implementation. Mostly, it replaces pImpl patterns with standard C++ code. The code is still a mess, but much less so then before. ## Checklist: <!--- This checklist serves as a reminder of a couple of things that ensure your pull request will be merged swiftly. --> - [x] The pull request only contains commits that are related to it. - [x] I have added appropriate tests and documentation. - [x] I have made sure that all CI jobs on GitHub pass. - [x] The pull request introduces no new warnings and follows the project's style guidelines.
- Loading branch information
Showing
45 changed files
with
3,508 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule LogicBlocks
deleted from
2d4d66
Submodule mqt-core
updated
17 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#pragma once | ||
|
||
#include "LogicBlock.hpp" | ||
#include "LogicTerm.hpp" | ||
|
||
#include <cmath> | ||
#include <cstddef> | ||
#include <cstdint> | ||
#include <set> | ||
#include <utility> | ||
#include <vector> | ||
|
||
namespace encodings { | ||
|
||
using namespace logicbase; | ||
|
||
struct NestedVar { | ||
explicit NestedVar(const LogicTerm& v) : var(v){}; | ||
NestedVar(const LogicTerm& v, std::vector<NestedVar> l) | ||
: var(v), list(std::move(l)) {} | ||
LogicTerm var = LogicTerm::noneTerm(); | ||
std::vector<NestedVar> list; | ||
}; | ||
|
||
struct WeightedVar { | ||
WeightedVar(const LogicTerm& v, const int w) : var(v), weight(w) {} | ||
LogicTerm var = LogicTerm::noneTerm(); | ||
int weight = 0; | ||
}; | ||
inline bool operator<(const WeightedVar& rhs, const WeightedVar& lhs) { | ||
return rhs.weight < lhs.weight; | ||
} | ||
inline bool operator==(const WeightedVar& rhs, const WeightedVar& lhs) { | ||
return rhs.weight == lhs.weight && rhs.var.getID() == lhs.var.getID(); | ||
} | ||
|
||
enum class Type : uint8_t { Uninitialized, AuxVar, ProgramVar }; | ||
struct SavedLit { | ||
SavedLit() : var(LogicTerm::noneTerm()) {} | ||
SavedLit(Type t, const LogicTerm& v) : type(t), var(v) {} | ||
Type type = Type::Uninitialized; | ||
LogicTerm var = LogicTerm::noneTerm(); | ||
}; | ||
|
||
LogicTerm atMostOneCmdr(const std::vector<NestedVar>& subords, | ||
const LogicTerm& cmdrVar, LogicBlock* logic); | ||
|
||
LogicTerm exactlyOneCmdr(const std::vector<NestedVar>& subords, | ||
const LogicTerm& cmdrVar, LogicBlock* logic); | ||
|
||
LogicTerm naiveExactlyOne(const std::vector<LogicTerm>& clauseVars); | ||
|
||
LogicTerm naiveAtMostOne(const std::vector<LogicTerm>& clauseVars); | ||
|
||
LogicTerm naiveAtLeastOne(const std::vector<LogicTerm>& clauseVars); | ||
|
||
LogicTerm atMostOneBiMander(const std::vector<LogicTerm>& vars, | ||
LogicBlock* logic); | ||
|
||
std::vector<NestedVar> groupVars(const std::vector<LogicTerm>& vars, | ||
std::size_t maxSize); | ||
std::vector<NestedVar> groupVarsAux(const std::vector<NestedVar>& vars, | ||
std::size_t maxSize); | ||
|
||
std::vector<std::vector<LogicTerm>> | ||
groupVarsBimander(const std::vector<LogicTerm>& vars, std::size_t groupCount); | ||
} // namespace encodings |
Oops, something went wrong.