-
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
1 parent
d931ddd
commit 0590943
Showing
14 changed files
with
435 additions
and
204 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,8 +1,26 @@ | ||
from pyschlandals import BranchingHeuristic | ||
from pyschlandals.compiler import compile | ||
from pyschlandals.pwmc import PyProblem | ||
|
||
import sys | ||
problem = PyProblem() | ||
problem.add_distribution([0.2, 0.8]) | ||
problem.add_distribution([0.3, 0.7]) | ||
problem.add_distribution([0.4, 0.6]) | ||
problem.add_distribution([0.1, 0.9]) | ||
problem.add_distribution([0.5, 0.5]) | ||
|
||
if __name__ == '__main__': | ||
dac = compile(sys.argv[1], BranchingHeuristic.MinInDegree) | ||
print(dac.get_circuit_probability()) | ||
problem.add_clause([11, -1]) | ||
problem.add_clause([12, -2]) | ||
problem.add_clause([13, -11, -3]) | ||
problem.add_clause([13, -12, -5]) | ||
problem.add_clause([14, -11, -4]) | ||
problem.add_clause([14, -12, -6]) | ||
problem.add_clause([15, -13, -7]) | ||
problem.add_clause([15, -14, -9]) | ||
problem.add_clause([16, -13, -8]) | ||
problem.add_clause([16, -14, -10]) | ||
problem.add_clause([-15]) | ||
|
||
# For one shot compilation/evaluation, just use compile(): | ||
print(problem.compile()) | ||
|
||
# However, you might want to store the compiled AC or visualize it as a DOT file | ||
problem.compile(fdac="out.ac", dotfile="ac.dot") |
This file was deleted.
Oops, something went wrong.
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,22 @@ | ||
from pyschlandals.pwmc import PyProblem | ||
|
||
problem = PyProblem() | ||
problem.add_distribution([0.2, 0.8]) | ||
problem.add_distribution([0.3, 0.7]) | ||
problem.add_distribution([0.4, 0.6]) | ||
problem.add_distribution([0.1, 0.9]) | ||
problem.add_distribution([0.5, 0.5]) | ||
|
||
problem.add_clause([11, -1]) | ||
problem.add_clause([12, -2]) | ||
problem.add_clause([13, -11, -3]) | ||
problem.add_clause([13, -12, -5]) | ||
problem.add_clause([14, -11, -4]) | ||
problem.add_clause([14, -12, -6]) | ||
problem.add_clause([15, -13, -7]) | ||
problem.add_clause([15, -14, -9]) | ||
problem.add_clause([16, -13, -8]) | ||
problem.add_clause([16, -14, -10]) | ||
problem.add_clause([-15]) | ||
|
||
print(problem.solve()) |
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,5 @@ | ||
Instance,Probability | ||
train_input/asia_xray_true.cnf,0.11029 | ||
train_input/asia_xray_false.cnf,0.88971 | ||
train_input/asia_dyspnea_true.cnf,0.435971 | ||
train_input/asia_dyspnea_false.cnf,0.564029 |
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,4 @@ | ||
from pyschlandals.learn import learn, PyLearnParameters | ||
|
||
params = PyLearnParameters() | ||
learn("train.csv", params) |
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.