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

How to set the Solver's verbosity? #59

Open
hadipourh opened this issue Jul 25, 2020 · 5 comments
Open

How to set the Solver's verbosity? #59

hadipourh opened this issue Jul 25, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@hadipourh
Copy link

hadipourh commented Jul 25, 2020

Dear Pysat developer's team,

Thanks for creating such a useful toolkit. I want to solve a SAT problem encoded as a CNF. I am using the following commands to read the dimacs file containing the obtained CNF:

cnf_formula = formula.CNF(self.cnf_file_path)
sat_solver = solvers.Cadical()
sat_solver.append_formula(cnf_formula)
result = sat_solver.solve()

What is important for me is seeing the outputs generated by the chosen SAT solver, when it is solving the problem, since SAT solvers usually print out useful data, such as the amount of used time, and memory, and some other useful data related to the solving process. So, how can I set the verbosity parameter of a SAT solver to see more details of solving process? Thank you in advance for your help.

Kind regards,
Hosein

@alexeyignatiev
Copy link
Collaborator

Hi Hosein,

You can't set verbosity of a solver. At this point, it is completely disabled. You can get some really basic statistics though by using accum_stats().

@hadipourh
Copy link
Author

hadipourh commented Jul 27, 2020

Dear Alexey,

Thanks for your reply. accum_stats() works well. I used it for Cadical as follows:

from pysat.solvers import Cadical
from pysat.examples.genhard import PHP
cnf = PHP(nof_holes=2)
with Cadical(bootstrap_with=cnf.clauses) as C:
    result = C.solve()
    stats = C.accum_stats()
print(result)
print(stats)
False
{'restarts': 0, 'conflicts': 2, 'decisions': 1, 'propagations': 9}

However, it would be very better if we could see the progress report generated by the solver on the fly, when the solver is running in the background. For example when I use Cadical separately, outside of Pysat, it prints out the progress report of solving process including the remaining percentage. Users might need to see the remaining percentage of solving process, especially when it takes too much time. I hope you consider this property in the future releases. Thank you again for your time, and efforts.

Kind regards,
Hosein

@alexeyignatiev
Copy link
Collaborator

Hi Hosain,

I agree that it would be great to have this done. But I am not sure when/if I will time for this... Again, any volunteers are more than welcome. :)

Alexey

@alexeyignatiev alexeyignatiev added the enhancement New feature or request label Jul 27, 2020
@hadipourh
Copy link
Author

Hello Alexey!

I will try to see how can I add this property, but I am not sure whether I can do it or not. I would be grateful if you let me know where I should start from. It must be related to the solvers module, yes?

@alexeyignatiev
Copy link
Collaborator

There are two parts that need to be changed here: (1) the solvers module and (2) the pysolvers C++ extension. Let me be honest: while doing part 1 is easy, the second part is going to be really tough. :) Let me think about how it could be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants