Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Open WBO totalizer encoding for At Most One constraints #26

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a5855f9
Use Open-WBOs Totalizer encoding for at most 1 constraint
sukrutrao Sep 13, 2018
c004b2f
Merge branch 'development' of github.com:GoodDeeds/Timetabler into de…
sukrutrao Sep 13, 2018
a86e126
Merge branch 'development' of github.com:GoodDeeds/Timetabler into de…
prateekkumarweb Sep 13, 2018
e5c7f57
Fix compiler error
prateekkumarweb Sep 13, 2018
f25a078
Use customized totalizer encoding based off OpenWBO
sukrutrao Sep 13, 2018
1da2314
Merge branch 'master' into totalizer
prateekkumarweb Oct 27, 2018
dea0f8b
Merge branch 'master' into totalizer
prateekkumarweb Nov 2, 2018
d2249c9
Merge branch 'master' into totalizer
prateekkumarweb Nov 2, 2018
b641830
Fix bug, minor improvements
prateekkumarweb Nov 9, 2018
0b0cbf7
Merge branch 'master' into bugfix
sukrutrao Nov 10, 2018
0a1b7b4
Use logger to indicate completed parsing
sukrutrao Nov 10, 2018
03dc6cc
Reset variables in custom_parser: constraint_expr
prateekkumarweb Nov 11, 2018
0a29355
Merge branch 'bugfix' of github.com:GoodDeeds/Timetabler into bugfix
prateekkumarweb Nov 11, 2018
c863bb7
yaml-cpp: Do not build unnecessary tools
prateekkumarweb Nov 11, 2018
402552b
snap: Fix issue with accessing home folder
prateekkumarweb Nov 11, 2018
c9c1f13
snap: Fix deprecated warning
prateekkumarweb Nov 11, 2018
d7cd72a
constraint_adder: unbundle some of the predefined constraints
prateekkumarweb Nov 13, 2018
f2d3859
Wrap custom parser grammar in namespace
prateekkumarweb Nov 13, 2018
e226f3f
doxygen: generate docs for custom constraint grammar
prateekkumarweb Nov 15, 2018
fdc5d46
doxygen: Add documentation of some of the undocumented functions
prateekkumarweb Nov 15, 2018
5737962
Predefined Constraint: Add high level vars for each course
prateekkumarweb Nov 17, 2018
c8b1d77
cmake: Add -Wpedantic flag
prateekkumarweb Nov 26, 2018
2885211
Change MinorType to enum class (also fixes isMinor bug)
prateekkumarweb Nov 29, 2018
2fec7b7
Parser: CSV Parser program Core/Elective/No
prateekkumarweb Nov 29, 2018
86478f6
Generate version number from git
prateekkumarweb Dec 12, 2018
9c552fe
Run gen_version.sh inside cmake
prateekkumarweb Dec 12, 2018
70cd9b2
Merge branch 'bugfix' into totalizer
prateekkumarweb Dec 12, 2018
95d4066
Fix compiling issue in src/totalizer.cpp
prateekkumarweb Dec 12, 2018
6440035
gen_version.sh: Disable print of version
prateekkumarweb Dec 12, 2018
045526a
snap: Fix version number in snap
prateekkumarweb Dec 12, 2018
8321fde
install_dependencies.sh: Update folder names to not contain version
prateekkumarweb Dec 13, 2018
0843e50
snap: Speed up dependency installation, fix version
prateekkumarweb Dec 13, 2018
0cf3353
Merge branch 'bugfix' into totalizer
prateekkumarweb Dec 13, 2018
b9ccec8
Fix hasEncoding in Totalizer build
prateekkumarweb Dec 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/constraint_encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,6 @@ Clauses ConstraintEncoder::hasAtMostOneFieldValueTrue(int course,
FieldType fieldType) {
std::vector<Var> varsToUse = getAllowedVars(course, fieldType);
Clauses result = timetabler->generateAtMostKTotalizerEncoding(varsToUse, 1);
// for (int i = 0; i < vars[course][fieldType].size(); i++) {
// for (int j = i + 1; j < vars[course][fieldType].size(); j++) {
// Clauses first(vars[course][fieldType][i]);
// Clauses second(vars[course][fieldType][j]);
// Clauses negSecond = ~second;
// result.addClauses(~first | negSecond);
// }
// }
return result;
}

Expand Down
3 changes: 3 additions & 0 deletions src/totalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include "totalizer.h"
#include "utils.h"

using namespace NSPACE;
using namespace openwbo;
Expand Down Expand Up @@ -219,6 +220,8 @@ void TTotalizer::build(MaxSATFormula *formula, vec<Lit> &lits, int64_t rhs) {
assert(rhs >= 1 && rhs <= lits.size());

if (incremental_strategy == _INCREMENTAL_NONE_ && rhs == lits.size()) {
DEBUG() << "Totalizer (Not incremental): Rhs is equal to lits.size()";
hasEncoding = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoodDeeds please check if this change is appropriate.

The issue was that when RHS is equal to lits.size(), hasEncoding was false and update step failed(Line 179).

return;
}

Expand Down