GithubHelp home page GithubHelp logo

computational-problem-solving / sat Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 2.33 MB

:satisfied: Boolean formula satisfiability algorithms for JavaScript

Home Page: https://computational-problem-solving.github.io/sat

License: GNU Affero General Public License v3.0

JavaScript 95.14% Shell 4.86%
np-complete k-sat algorithms agpl javascript computer-science sat-solver reductions sat0w

sat's Introduction


© xkcd.com

Boolean formula satisfiability algorithms for JavaScript. See docs. Parent is js-algorithms. For a polynomial time algorithm for the 2SAT problem see @problem-solving/2sat.

let instance = sat.from.signs( [ [ -1 , 2 , 3 ] , [ -2 , -4 , 5 ] , [ 1 , -5 ] ] ) ;
// or
// let instance = sat.from.keys(
// [
//   [ [ false , '1' ] , [ true , '2' ] , [ true , '3' ] ] ,
//   [ [ false , '2' ] , [ false , '4' ] , [ true , '5' ] ] ,
//   [ [ true , '1' ] , [ false , '5' ] ]
// ]
// ) ;
sat.decide( instance ) ; // true
sat.verify( instance , sat.solve( instance ).next( ).value ) ; // true
for ( let certificate of sat.solve( instance ) ) {
    console.log( instance.assignment( certificate ) ) ;
}

License Version Tests Dependencies GitHub issues Downloads

Code issues Code maintainability Code coverage (cov) Code technical debt Documentation Package size

📜 Reference

sat's People

Contributors

a-flying-potato avatar greenkeeper[bot] avatar greenkeeperio-bot avatar make-github-pseudonymous-again avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sat's Issues

Test case with 2 contradictory clauses runs forever

Here's the test case:

require("babel-polyfill");
const sat = require("@aureooms/js-sat");

const instance = sat.from.parities([[80], [81]]);
console.log(JSON.stringify(instance));
console.log(sat.decide(instance));

On my x64 Windows box, when I save this as sat.js and run "node sat.js", I get the following:

node sat.js
{"clauses":[[80],[81]],"n":41}

It just spins forever using up one my CPUs. If I change the clauses to [[0], [1]], it runs quickly and correctly decides that these clauses are not satisfiable. Starting around [[50], [51]], things get really slow.

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • ⬆️ deps: Upgrade JamesIves/github-pages-deploy-action action to v4.1.5
  • ⬆️ deps: Upgrade dependency husky to v7.0.2
  • ⬆️ deps: Upgrade babel monorepo (@babel/core, @babel/preset-env, @babel/register)
  • ⬆️ deps: Upgrade dependency @commitlint/cli to v13.2.1
  • ⬆️ deps: Upgrade dependency babel-plugin-unassert to v3.2.0
  • ⬆️ deps: Upgrade dependency c8 to v7.10.0
  • ⬆️ deps: Upgrade dependency lint-staged to v11.2.3
  • ⬆️ deps: Upgrade dependency microbundle to v0.14.1

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.


  • Check this box to trigger a request for Renovate to run again on this repository

Skip unused variables.

See discussion in #36. One way to solve this problem is to introduce a variable mapping for sat.from.parities and sat.from.signs.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

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.