Categorygithub.com/booleworks/logicng-service
modulepackage
0.0.3
Repository: https://github.com/booleworks/logicng-service.git
Documentation: pkg.go.dev

# README

logo

Go Reference license

LogicNG as a Service

A web service based on LogicNG.

It exposes over 50 LogicNG functions as REST Web Services, among them

  • SAT Solver
  • MaxSAT Solver
  • BDD Compilation
  • DNNF Compilation
  • Normal Forms
  • Formula Simplifications
  • ...

Many of the algorithms can be parametrized via query parameters. Input/Output can be JSON or Protocol Buffer (configured via accept and Content-Type headers of the HTTP request).

Usage

Compile it yourself

Install and initialize swag (required for generating the Swagger UI)

go install github.com/swaggo/swag/cmd/swag@latest
swag init

Run the service with a simple

go run main.go

This fires up the server on port 8080 with a default computation timeout of 5 seconds. You can modify these parameters with

go run main.go -host "hostname" -port 9090 -timeout "20s"

to start the server on host "hostname", port 9090, and a timeout of 20 seconds.

Use the binary

You can just download a binary under releases and you should be ready to go.

Docker

... or just use docker

docker run -p 8080:8080 ghcr.io/booleworks/logicng-service:0.0.2

Swagger

A swagger documentation of all endpoints is available at $host:$port/swagger and should illustrate all available algorithms and configuration parameters.

swagger swagger details

Functions

MethodEndpointInputOutputQuery Params
POSTassignment/evaluationAssignmentInputBoolResult-
POSTassignment/restrictionAssignmentInputFormulaResult-
POSTbdd/compilationFormulaInputGraphResultVariable Ordering
POSTbdd/graphicalFormulaInputStringVariable Ordering, Graph Format
POSTdnnf/compilationFormulaInputFormulaResult-
POSTencoding/ccFormulaInputFormulaResultEncoding Algorithm
POSTencoding/pbcFormulaInputFormulaResultEncoding Algorithm
POSTexplanation/musFormulaInputFormulaResultMUS Algorithm
POSTexplanation/smusFormulaInputFormulaResult-
POSTformula/atomsFormulaInputIntResult-
POSTformula/depthFormulaInputIntResult-
POSTformula/graphicalFormulaInputStringGraph Type, Graph Format
POSTformula/lit-profileFormulaInputProfileResult-
POSTformula/literalsFormulaInputStringSetResult-
POSTformula/nodesFormulaInputIntResult-
POSTformula/sub-formulasFormulaInputFormulaResult-
POSTformula/var-profileFormulaInputProfileResult-
POSTformula/variablesFormulaInputStringSetResult-
POSTgraph/componentsFormulaInputComponentResult-
POSTgraph/constraintFormulaInputGraphResult-
POSTgraph/constraint/graphicalFormulaInputStringGraph Format
POSTmodel/countingFormulaInputStringResultCounting Algorithm
POSTmodel/counting/projectionFormulaVarsInputStringResultCounting Algorithm
POSTmodel/enumerationFormulaInputFormulaResultEnumeration Algorithm
POSTmodel/enumeration/projectionFormulaVarsInputFormulaResultEnumeration Algorithm
POSTnormalform/predicate/nnfFormulaInputBoolResult-
POSTnormalform/predicate/cnfFormulaInputBoolResult-
POSTnormalform/predicate/dnfFormulaInputBoolResult-
POSTnormalform/predicate/aigFormulaInputBoolResult-
POSTnormalform/predicate/mintermFormulaInputBoolResult-
POSTnormalform/predicate/maxtermFormulaInputBoolResult-
POSTnormalform/transformation/aigFormulaInputFormulaResult-
POSTnormalform/transformation/cnfFormulaInputFormulaResultCNF Algorithm
POSTnormalform/transformation/dnfFormulaInputFormulaResultDNF Algorithm
POSTnormalform/transformation/nnfFormulaInputFormulaResult-
POSTprime/minimal-coverFormulaInputFormulaResultMin or Max Models
POSTprime/minimal-implicantFormulaInputFormulaResult-
GETrandomizer-FormulaResultSeed, Depth, Vars, Formulas
POSTsimplification/advancedFormulaInputFormulaResultBackbone, Factor Out, Negation Flags
POSTsimplification/backboneFormulaInputFormulaResult-
POSTsimplification/distributionFormulaInputFormulaResult-
POSTsimplification/factoroutFormulaInputFormulaResult-
POSTsimplification/negationFormulaInputFormulaResult-
POSTsimplification/qmcFormulaInputFormulaResult-
POSTsimplification/subsumptionFormulaInputFormulaResult-
POSTsimplification/unitpropagationFormulaInputFormulaResult-
POSTsolver/backboneFormulaInputBackboneResult-
POSTsolver/maxsatMaxSatInputMaxSatResultMaxSAT Algorithm
POSTsolver/predicate/contradictionFormulaInputBoolResult-
POSTsolver/predicate/equivalenceFormulaInputBoolResult-
POSTsolver/predicate/implicationFormulaInputBoolResult-
POSTsolver/predicate/tautologyFormulaInputBoolResult-
POSTsolver/satFormulaInputSatResultUNSAT Core Flag
POSTsubstitution/anonymizationFormulaInputFormulaResultVariable Prefix
POSTsubstitution/variablesSubstitutionInputFormulaResult-

Chaining

The API is designed in a way, that the output of many of the endpoints can be used as input to many other endpoints. So e.g. you can simply pass a set of formulas, substitute some variables, anonymize the formula, compute a normal form, and generate a Mermaid.js visualization of the resulting formula without ever manipulating the input/output. In the table above this means that you always can use a FormulaResult from one endpoint directly as FormulaInput for another endpoint.

Disclaimer

This is a funny little side project for playing around with Go Web Services (Standard Library only, no frameworks).
It is by no means a production-ready piece of software with bells and whistles. But if you just need some logical computations and don't want to integrate LogicNG in Go/Rust/Java in you project - perhaps it's for you :)

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author