README
js-sat
Satisfiability code bricks for JavaScript.
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 ) ) ;
}
Can be managed through jspm, duo, component, bower, ender, jam, spm, and npm.
Install
jspm
jspm install github:aureooms/js-sat
# or
jspm install npm:aureooms-js-sat
duo
No install step needed for duo!
component
component install aureooms/js-sat
bower
bower install aureooms-js-sat
ender
ender add aureooms-js-sat
jam
jam install aureooms-js-sat
spm
spm install aureooms-js-sat --save
npm
npm install aureooms-js-sat --save
Require
jspm
let sat = require( "github:aureooms/js-sat" ) ;
// or
import sat from 'aureooms-js-sat' ;
duo
let sat = require( "aureooms/js-sat" ) ;
component, ender, spm, npm
let sat = require( "aureooms-js-sat" ) ;
bower
The script tag exposes the global variable sat
.
<script src="bower_components/aureooms-js-sat/js/dist/sat.min.js"></script>
Alternatively, you can use any tool mentioned here.
jam
require( [ "aureooms-js-sat" ] , function ( sat ) { ... } ) ;