Skip to content

Commit 7663525

Browse files
authored
Merge pull request #19 from ML-KULeuven/develop
Mainly bugfixes, but we also changed the Term's hashing method. If this proofs to be worse, we may reconsider switching back later. * Bugfix library/string.py::str2lst (public issue #84) * Bugfix return exit code instead of result - only for probability task atm (public issue #82) * Critical Bugfix in dSharp library (compiled CNF theory with too long clauses could yield wrong result) * Bugfix in pypl related to lists (private issue #16) * Minor improvements to LFI * Changed Term's hashing method
2 parents b719042 + d818f94 commit 7663525

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+75275
-186
lines changed

INSTALL

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ For better performance you can also run ProbLog with PyPy:
1313
http://pypy.org/download.html
1414

1515
ProbLog's evaluation is based on knowledge compilation tools.
16-
By default it uses dsharp [https://bitbucket.org/haz/dsharp].
16+
By default it uses dsharp [https://github.com/QuMuLab/dsharp/].
1717

1818
It also supports two other tools:
1919
* C2D Compiler (NNF) [http://reasoning.cs.ucla.edu/c2d/]
@@ -88,10 +88,30 @@ C2D is automatically used instead of dsharp when detected.
8888
Licenses of included third-party software
8989
-----------------------------------------
9090

91-
DSharp [https://bitbucket.org/haz/dsharp]
91+
DSharp [https://github.com/QuMuLab/dsharp/]
9292
+++++++++++++++++++++++++++++++++++++++++
9393

94-
GPLv2
94+
MIT License
95+
96+
Copyright (c) 2022 Christian Muise
97+
98+
Permission is hereby granted, free of charge, to any person obtaining a copy
99+
of this software and associated documentation files (the "Software"), to deal
100+
in the Software without restriction, including without limitation the rights
101+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
102+
copies of the Software, and to permit persons to whom the Software is
103+
furnished to do so, subject to the following conditions:
104+
105+
The above copyright notice and this permission notice shall be included in all
106+
copies or substantial portions of the Software.
107+
108+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
109+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
110+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
111+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
112+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
113+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
114+
SOFTWARE.
95115

96116
SDD [http://reasoning.cs.ucla.edu/sdd/]
97117
+++++++++++++++++++++++++++++++++++++++

KNOWN_ISSUES

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ There are two possible solutions:
3333

3434
- Use a different knowledge compiler that does not have this issue (c2d or SDD).
3535

36-
- Compile a dSharp 32-bit version (dSharp source: https://bitbucket.org/haz/dsharp/src/default/)
36+
- Compile a dSharp 32-bit version (dSharp source: https://github.com/QuMuLab/dsharp/)
3737
and replace the original dSharp file with it. The path can be found in the OSError message.
3838
Alternatively, use the 32-bit version in this zip: https://github.com/ML-KULeuven/problog/files/3448011/dsharp.zip
39+
Note: the .zip version is outdated and needs to be replaced (that binary has a limit on CNF clause length).

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ tested on *Mac OSX*, *Linux* and *Windows*.
2323

2424
[![CircleCI](https://circleci.com/gh/ML-KULeuven/problog/tree/master.svg?style=svg)](https://circleci.com/gh/ML-KULeuven/problog/tree/master)
2525
[![codecov](https://codecov.io/gh/ML-KULeuven/problog/branch/master/graph/badge.svg)](https://codecov.io/gh/ML-KULeuven/problog/branch/master)
26-
dev:
27-
[![CircleCI](https://circleci.com/gh/ML-KULeuven/problog/tree/develop.svg?style=svg)](https://circleci.com/gh/ML-KULeuven/problog/tree/develop)
28-
[![codecov](https://codecov.io/gh/ML-KULeuven/problog/branch/develop/graph/badge.svg)](https://codecov.io/gh/ML-KULeuven/problog/branch/develop)
29-
3026

3127
ProbLog supports optional components which can be installed separately.
3228
See the file [INSTALL](https://github.com/ML-KULeuven/problog/blob/develop/INSTALL) for detailed installation instructions.

conversions/bn2problog.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import sys
1010
import os
1111
import argparse
12-
import itertools
1312
import logging
1413
import abc
1514

@@ -77,13 +76,13 @@ def add_parser_arguments(parser):
7776
"--valueinatomname",
7877
action="store_false",
7978
help="Add value to atom name instead as a term (this removes invalid characters, "
80-
"be careful that clean values do not overlap)",
79+
"be careful that clean values do not overlap)",
8180
)
8281
parser.add_argument(
8382
"--adisfunction",
8483
action="store_true",
8584
help="Consider all ADs to represent functions of mutual exclusive conditions (like "
86-
"in a Bayesian net)",
85+
"in a Bayesian net)",
8786
)
8887
parser.add_argument("--compress", action="store_true", help="Compress tables")
8988
parser.add_argument(

conversions/pyparsing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ def dump(self, indent="", depth=0):
872872
def pprint(self, *args, **kwargs):
873873
"""Pretty-printer for parsed results as a list, using the C{pprint} module.
874874
Accepts additional positional or keyword args as defined for the
875-
C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})"""
875+
C{pprint.pprint} method. (U{https://docs.python.org/3/library/pprint.html#pprint.pprint})"""
876876
pprint.pprint(self.asList(), *args, **kwargs)
877877

878878
# add support for pickle protocol

problog-cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
you may not use this file except in compliance with the License.
99
You may obtain a copy of the License at
1010
11-
http://www.apache.org/licenses/LICENSE-2.0
11+
https://www.apache.org/licenses/LICENSE-2.0
1212
1313
Unless required by applicable law or agreed to in writing, software
1414
distributed under the License is distributed on an "AS IS" BASIS,

problog/bin/darwin/dsharp

54.5 KB
Binary file not shown.

problog/bin/linux/dsharp

19.4 KB
Binary file not shown.

problog/bin/windows/dsharp.exe

100755100644
113 KB
Binary file not shown.

problog/clausedb.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -875,13 +875,18 @@ def _create_alias(
875875

876876
def load_external_module(self, filename):
877877
from .extern import problog_export
878-
import imp
879878

880879
problog_export.database = self
881-
882880
module_name = os.path.splitext(os.path.split(filename)[-1])[0]
883-
with open(filename, "r") as extfile:
884-
imp.load_module(module_name, extfile, filename, (".py", "U", 1))
881+
882+
# Replaced deprecated imp.load_module()
883+
# source: https://stackoverflow.com/a/19011259
884+
import importlib.machinery
885+
import importlib.util
886+
loader = importlib.machinery.SourceFileLoader(module_name, filename)
887+
module_spec = importlib.util.spec_from_loader(loader.name, loader)
888+
new_module = importlib.util.module_from_spec(module_spec)
889+
loader.exec_module(new_module)
885890

886891
return module_name, self.__extern[module_name]
887892

0 commit comments

Comments
 (0)