fdq
v0.0.4
Published
Finite Domain reduction system and solver by qFox
Downloads
8
Maintainers
Readme
FDQ - Finite Domain solver by qFox
This is a finite domain reduction system and solver combined. The fdq package combines fdo and fdq together.
Usage
After the customary npm install fdq
, you can find the main entry point in FDQ.solve(problem, fdpOptions, fdoOptions)
.
For example:
import FDQ from 'fdq';
let solution = FDQ.solve(`
: A, B, C [0 1]
A != B
A !& C
`);
log(solution); // -> {A: 0, B: 1, C: 1}
Examples
There is a REPL (online web-based playground) available: https://qfox.github.io/fdq/examples/playground.html
Some examples:
Development
To set up a development environment create a main project dir. Inside it clone the following repos:
- fdh - all the generic e2e/integration tests for both fdo and fdq
- fdlib - shared code for fdo and fdq
- fdo - a constraint brute force solver
- fdp - a constraint problem reduction system
- fdq - this repo
- fdv - an automated verifier for tests
- fdz - (optional) these are performance tests (they might be merged into the fdq repo instead)
Run npm install
and you should be able to use the CLI tools.
CLI
Grunt scripts:
grunt clean
- removebuild
anddist
grunt build
- concat all the source files fromfdlib
,fdo
, andfdp
together and babel them to es5grunt dist
- lint, test, build, and minify, this creates the final dist buildgrunt distq
- dist build only, also generates a more genericfdq.js
grunt distbug
- like build but instead of minify keeps development mnemonics like logging and assertionsgrunt distheat
- like build instead of minify does a beautifygrunt test
- lint and test, also copies tofdq.js
grunt testq
- distq and run tests, collect all errors, also copies tofdq.js
grunt testb
- distb and run tests, collect all errors, also copies tofdq.js
grunt testh
- disth and run tests, collect all errors, also copies tofdq.js
grunt testtb
- distq and run tests, fail fast, also copies tofdq.js
Note: for the build scripts, dist/fdq.js
is a generic output file for both dev and dist builds (since they also create descriptive output files, fdq.js
just makes it easy to reference from tests or web no matter which build script you ran).
NPM scripts:
npm run coverage
- runs mocha, istanbul, and isparta to generate code coverage of all the testsnpm run lint
- runs eslintnpm run lintdev
- runs eslint with slightly relaxer rules (like allowingconsole.log
)npm run lintfix
- runs eslint with the --fix option to automatically fixup certain rules quickly