generated from potassco/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
287 additions
and
151 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
import time | ||
|
||
import clingo | ||
|
||
from clingexplaid.utils import get_solver_literal_lookup | ||
from clingexplaid.utils.transformer import AssumptionTransformer | ||
from clingexplaid.utils.muc import CoreComputer | ||
|
||
|
||
sig = [ | ||
('dog', 1), | ||
('mantis', 1), | ||
('axolotl', 1), | ||
('something_true', 0), | ||
('snake', 1), | ||
('test', 0) | ||
] | ||
|
||
at = AssumptionTransformer(sig) | ||
|
||
files = ["temp/instance.lp", "temp/encoding.lp"] | ||
|
||
ctl = clingo.Control() | ||
|
||
transformed_program = "" | ||
|
||
for f in files: | ||
transformed_program += at.parse_file(f) + "\n" | ||
|
||
ctl.add("base", [], transformed_program) | ||
|
||
ctl.ground([("base", [])]) | ||
|
||
literal_lookup = get_solver_literal_lookup(ctl) | ||
|
||
assumptions = at.get_assumptions(ctl) | ||
print(assumptions, [str(literal_lookup[a]) for a in assumptions]) | ||
|
||
cc = CoreComputer(ctl, assumptions) | ||
|
||
ctl.solve(assumptions=list(assumptions), on_core=cc.shrink) | ||
print(cc.minimal) | ||
# import time | ||
# | ||
# import clingo | ||
# | ||
# from clingexplaid.utils import get_solver_literal_lookup | ||
# from clingexplaid.utils.transformer import AssumptionTransformer | ||
# from clingexplaid.utils.muc import CoreComputer | ||
# | ||
# | ||
# sig = [ | ||
# ('dog', 1), | ||
# ('mantis', 1), | ||
# ('axolotl', 1), | ||
# ('something_true', 0), | ||
# ('snake', 1), | ||
# ('test', 0) | ||
# ] | ||
# | ||
# at = AssumptionTransformer(sig) | ||
# | ||
# files = ["temp/instance.lp", "temp/encoding.lp"] | ||
# | ||
# ctl = clingo.Control() | ||
# | ||
# transformed_program = "" | ||
# | ||
# for f in files: | ||
# transformed_program += at.parse_file(f) + "\n" | ||
# | ||
# ctl.add("base", [], transformed_program) | ||
# | ||
# ctl.ground([("base", [])]) | ||
# | ||
# literal_lookup = get_solver_literal_lookup(ctl) | ||
# | ||
# assumptions = at.get_assumptions(ctl) | ||
# print(assumptions, [str(literal_lookup[a]) for a in assumptions]) | ||
# | ||
# cc = CoreComputer(ctl, assumptions) | ||
# | ||
# ctl.solve(assumptions=list(assumptions), on_core=cc.shrink) | ||
# print(cc.minimal) |
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
Oops, something went wrong.