SolverFactory

interface SolverFactory

A factory for a specific Solver implementation (i.e. a specific resolution strategy), providing both defaults for every piece of a solver's state and constructors for Solver/MutableSolver instances.

Each resolution strategy module (:solve-classic, :solve-streams, :solve-concurrent, :solve-problog) provides its own SolverFactory implementation, reachable from Solver's companion object (e.g. Solver.prolog). All factories are interchangeable from client code's perspective, since they all produce the same Solver interface.

See also

Properties

Link copied to clipboard
abstract val defaultBuiltins: Library

The standard-library Library this implementation ships with (see defaultBuiltins usages in ...WithDefaultBuiltins methods).

Link copied to clipboard

The default (empty) dynamic knowledge base for solvers created by this factory.

Link copied to clipboard

The default standard error channel for solvers created by this factory.

Link copied to clipboard

The default FlagStore for solvers created by this factory.

Link copied to clipboard

The default standard input channel for solvers created by this factory.

Link copied to clipboard

The default standard output channel for solvers created by this factory.

Link copied to clipboard

The default Runtime of loaded libraries for solvers created by this factory; empty unless overridden.

Link copied to clipboard

The default (empty) static knowledge base for solvers created by this factory.

Link copied to clipboard

The default Unificator for solvers created by this factory.

Link copied to clipboard

The default warnings channel for solvers created by this factory.

Functions

Link copied to clipboard
abstract fun mutableSolverOf(unificator: Unificator = defaultUnificator, libraries: Runtime = defaultRuntime, flags: FlagStore = defaultFlags, staticKb: Theory = defaultStaticKb, dynamicKb: Theory = defaultDynamicKb, inputs: InputStore = InputStore.fromStandard(defaultInputChannel), outputs: OutputStore = OutputStore.fromStandard( defaultOutputChannel, defaultErrorChannel, defaultWarningsChannel, )): MutableSolver

Same as rawSolverOf, but returns a MutableSolver.

abstract fun mutableSolverOf(unificator: Unificator = defaultUnificator, libraries: Runtime = defaultRuntime, flags: FlagStore = defaultFlags, staticKb: Theory = defaultStaticKb, dynamicKb: Theory = defaultDynamicKb, stdIn: InputChannel<String> = defaultInputChannel, stdOut: OutputChannel<String> = defaultOutputChannel, stdErr: OutputChannel<String> = defaultErrorChannel, warnings: OutputChannel<Warning> = defaultWarningsChannel): MutableSolver

Same as solverOf, but returns a MutableSolver. Does not include defaultBuiltins.

Link copied to clipboard
open fun mutableSolverWithDefaultBuiltins(unificator: Unificator = defaultUnificator, otherLibraries: Runtime = defaultRuntime, flags: FlagStore = defaultFlags, staticKb: Theory = defaultStaticKb, dynamicKb: Theory = defaultDynamicKb, stdIn: InputChannel<String> = defaultInputChannel, stdOut: OutputChannel<String> = defaultOutputChannel, stdErr: OutputChannel<String> = defaultErrorChannel, warnings: OutputChannel<Warning> = defaultWarningsChannel): MutableSolver

Same as mutableSolverOf, but adds defaultBuiltins on top of otherLibraries.

Link copied to clipboard

Returns a new, mutable SolverBuilder seeded with this factory's defaults, for fluent, stepwise construction.

Link copied to clipboard
abstract fun solverOf(unificator: Unificator = defaultUnificator, libraries: Runtime = defaultRuntime, flags: FlagStore = defaultFlags, staticKb: Theory = defaultStaticKb, dynamicKb: Theory = defaultDynamicKb, inputs: InputStore = InputStore.fromStandard(defaultInputChannel), outputs: OutputStore = OutputStore.fromStandard( defaultOutputChannel, defaultErrorChannel, defaultWarningsChannel, )): Solver

Creates a new Solver, with an explicit InputStore/OutputStore rather than individual channels.

abstract fun solverOf(unificator: Unificator = defaultUnificator, libraries: Runtime = defaultRuntime, flags: FlagStore = defaultFlags, staticKb: Theory = defaultStaticKb, dynamicKb: Theory = defaultDynamicKb, stdIn: InputChannel<String> = defaultInputChannel, stdOut: OutputChannel<String> = defaultOutputChannel, stdErr: OutputChannel<String> = defaultErrorChannel, warnings: OutputChannel<Warning> = defaultWarningsChannel): Solver

Creates a new Solver with this implementation's resolution strategy, defaulting every unspecified argument to this factory's default* values. Does not include defaultBuiltins; see solverWithDefaultBuiltins for that.

Link copied to clipboard
open fun solverWithDefaultBuiltins(unificator: Unificator = defaultUnificator, otherLibraries: Runtime = defaultRuntime, flags: FlagStore = defaultFlags, staticKb: Theory = defaultStaticKb, dynamicKb: Theory = defaultDynamicKb, stdIn: InputChannel<String> = defaultInputChannel, stdOut: OutputChannel<String> = defaultOutputChannel, stdErr: OutputChannel<String> = defaultErrorChannel, warnings: OutputChannel<Warning> = defaultWarningsChannel): Solver

Same as solverOf, but adds defaultBuiltins on top of otherLibraries.