Skip to content

API Reference

paramita.encoders module

PbToCnfEncoder

Bases: Plugin

An encoder from PB constraints to Satisfiability CNF.

ContextState

Opaque type for storing arbitrary context for incremental encoders.

encode

encode(constraint, container, context=None)

Encode the PB constraint to the specified container.

This method receives an optional that the encoder can use to encode constraints incrementally.

In this sense, it can also return another to be used by the same encoder later.

Non-incremental encoders can fully ignore the , both as parameter and return value.

Parameters:

Name Type Description Default
constraint PbConstraint

The to be encoded to CNF.

required
container ClauseContainer

A where clauses will be added.

required
context ContextState | None

An (possibly empty) for incremental encoders.

None

Returns:

Type Description
ContextState

A (possibly empty) to be used by the same encoder to incrementally encode constraints in subsequent calls.

get

get(name)

Get the parameter's value.

Parameters:

Name Type Description Default
name str

The name of the parameter.

required

Returns:

Type Description
str | int | float | bool | SatSolver | NonIncrSatSolver | ClauseContainer | NonIncrMaxSatSolver | WClauseContainer | PbToCnfEncoder | Plugin

The value of the parameter.

get_parameter_space

get_parameter_space()

Get the parameter space for this class.

Returns:

Type Description
ParameterSpace

The parameter space.

set

set(name, value)

Set a parameter.

Parameters:

Name Type Description Default
name str

The name of the parameter.

required
value str | int | float | bool | SatSolver | NonIncrSatSolver | ClauseContainer | NonIncrMaxSatSolver | WClauseContainer | PbToCnfEncoder | Plugin

The value to set the parameter to.

required