Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
m2cSMT
m2cSMT is a solver of non-linear (in)equations encoded in a subset of the SMT-Lib format. One possible use is to solve trigonometric configuration problems.
m2cSMT uses Interval Constraint Propagation on floating point intervals, with outward-directed rounding of computations.
Installation
To run a file from the command line, install rust, download this repository and, in the root of the folder:
To include the library in a rust project, add to cargo.toml:
[]
= "0"
and to .cargo/config.toml:
[]
= ["-C", "target-cpu=haswell"]
= ["-C", "target-cpu=haswell"]
Usage
To solve x²-2x+1 = 0, create file demo.smt2:
(declare-const x Real)
(assert (= (+ (** x 2) (* -2.0 x) 1.0) 0.0))
(check-sat)
(get-model)
Run it with :
You should get:
delta_sat with absolute precision 0.0005027206300594056
x = [0.998001,0.998252]
The equation is indeed satisfied with a precision of 0.0005.
You can obtain the same results in rust:
use Solver;
let source = "
(declare-const x Real)
(assert (= (+ (** x 2) (* -2.0 x) 1.0) 0.0))
(check-sat)
(get-model)";
let mut solver = default;
for result in solver.parse_and_execute
Or, using the Command API:
use Solver;
use ;
use *;
let source = vec!;
let mut solver = default;
for result in solver.execute
Support
Please report errors and suggestions via issues in the Gitlab repository.
Roadmap
Future developments include:
- improve performance, e.g., by using the derivative of the formula.
- extend it with a boolean satisifiability solver.
Contributing
Contributions are welcome: issues and suggestions, rust code, realistic benchmarks, ... In particular, we welcome benchmarks inspired by real-life problems.
The technical documentation is available in the src/_technical_doc.md file.
Authors and acknowledgment
Many thanks to the rust community and, in particular, to the authors of the interval arithmetic library called inari.
License
MIT