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 attribute's value.

Parameters:

Name Type Description Default
name str

The name of the attribute.

required

Returns:

Type Description
Value

The value of the attribute.

get_parameter_space

get_parameter_space()

Get the parameter space for this class.

Returns:

Type Description
ParameterSpace

The parameter space.

list_attributes

list_attributes()

List all the available attributes for this plugin.

The attributes of a plugin are arbitrary values that can be set or retrieved by using the set and get methods.

set

set(name, value)

Set an attribute.

Parameters:

Name Type Description Default
name str

The name of the attribute.

required
value Value

The value to set the attribute to.

required