GithubHelp home page GithubHelp logo

Comments (2)

alexeyignatiev avatar alexeyignatiev commented on August 17, 2024

Hi @fransab,

The documentation should say (see the list of expected arguments and their types) that the input parameters to MUSX and OptUx should be weighted formulas. Namely, MUSX expects to get a WCNF object while OptUx wants WCNFPlus object. To make your example work, you can make a tiny modification (a call to .weighted(), which will create a weighted variant of the formula for you):

>>> from pysat.examples.musx import MUSX
>>> cnf = CNF(from_clauses=[[1, 2], [-1], [-2]])
>>> musx = MUSX(cnf.weighted(), verbosity=0)
>>> musx.compute()
[1, 2, 3]
>>> musx.delete()
>>> with OptUx(cnf.weighted()) as optux:
...     for mus in optux.enumerate():
...         print('mus {0} has cost {1}'.format(mus, optux.cost))
...
mus [1, 2, 3] has cost 3

Note that you can call either of these tools on an unweighted *.cnf file because the script will call .weighted() for you after parsing the file.

As for the WCNF file you are creating, it is incorrect. If you want each clause to be considered as a culprit for unsatisfiability then each clause should be marked as soft. This means you should set the top weight (in the preamble) to the sum of weights for all soft clauses + 1, i.e. it should be 4 rather than 1. Currently, all the clauses in the file are made hard, hence the cores MUSX and OptUx are getting are empty.

I hope this helps,
Alexey

from pysat.

fransab avatar fransab commented on August 17, 2024

Thanks for your help @alexeyignatiev .
I guess it would be nice for these MUS extractors to directly support formulas in CNF formulas, given the minimal modification required, unless specific situations could return an unwanted result ?
Sorry for my misunderstanding of the WCNF format and thanks for your clarification, I understand why it works now.

Francesco

from pysat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.