sthiele / pyasp

A convenience wrapper for the ASP tools gringo, gringo4 and clasp
https://pypi.python.org/pypi/pyasp
GNU General Public License v3.0
8 stars 2 forks source link

Threading option of Clasp leads to 'OPTIMUM FOUND but zero optimals' warning and no model #8

Open Aluriak opened 8 years ago

Aluriak commented 8 years ago

It appears that define the --parallel-mode clasp option leads to a warning, and an unsatisfiable result. (no model found)

Here is the python program:

from pyasp import asp

PROGRAM = """

% choose two values
values(1..10).
2 {choosen(X): values(X)} 2.

% score is the sum of the values
score(S):- S=#sum{X:choosen(X)}.

% maximize the score
#maximize{S:score(S)}.

#show.
#show choosen/1.
#show score/1.

"""

def test(clasp_options):
    solver = asp.Gringo4Clasp(clasp_options=clasp_options)
    return solver.run([], additionalProgramText=PROGRAM)

print('FIRST: no clasp option:')
print('answers:', test(''))
print('-----------------------')
print('SECOND: use 2 threads:')
print('answers:', test('--parallel-mode=2'))

Result (python 3.4.3):

FIRST: no clasp option:
answers: [TermSet({'score(19)', 'choosen(10)', 'choosen(9)'})]
-----------------------
SECOND: use 2 threads:
WARNING: OPTIMUM FOUND but zero optimals
answers: []
sthiele commented 8 years ago

This seems to be a bug in clasp. I'm contacting the developer. (see BUG#116)

sthiele commented 8 years ago

Benjamin released a patch to fix this issue in the 3.1.4 version of clasp. parallel_solve.cpp.patch

Aluriak commented 8 years ago

Awesome, thank you !