model

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package model provides a data structure for Boolean models in LogicNG. A model is just a list of literals.

In contrast to the assignment found in the assignment package, a model stores the literals internally just as a list without checking for duplicates or contrary assignments. This makes their generation more performant. Models usually are used by algorithms (like model enumeration, or getting a model from a solver) which guarantee that the stored literals are unique and contradiction-free.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	Literals []f.Literal
}

A Model represents a list of literals.

func FromAssignment

func FromAssignment(fac f.Factory, ass assignment.Assignment) *Model

FromAssignment generates a new model from a given assignment.

func New

func New(literals ...f.Literal) *Model

New returns a new model with the given literals

func (*Model) AddLiteral

func (m *Model) AddLiteral(literals ...f.Literal)

AddLiteral adds the given literals to the model.

func (*Model) Assignment

func (m *Model) Assignment(fac f.Factory) (*assignment.Assignment, error)

Assignment returns an assignment from the model. Returns an error if this model contains complementary literals (which should not happen if used right).

func (*Model) Formula

func (m *Model) Formula(fac f.Factory) f.Formula

Formula returns a formula for the model which is the conjunction of its literals.

func (*Model) NegLits

func (m *Model) NegLits() []f.Literal

NegLits returns the negative literals of the model.

func (*Model) NegVars

func (m *Model) NegVars() []f.Variable

NegVars returns the negative variables of the model.

func (*Model) PosVars

func (m *Model) PosVars() []f.Variable

PosVars returns the positive variables of the model.

func (*Model) Size

func (m *Model) Size() int

Size returns the size of the model.

func (*Model) Sprint

func (m *Model) Sprint(fac f.Factory) string

Sprint prints the model in human-readable form.

Directories

Path Synopsis
Package count provides algorithms for counting models on formulas in LogicNG.
Package count provides algorithms for counting models on formulas in LogicNG.
Package enum provides algorithms to perform model enumeration on formulas in LogicNG.
Package enum provides algorithms to perform model enumeration on formulas in LogicNG.
Package iter gathers functionality for model iteration in LogicNG.
Package iter gathers functionality for model iteration in LogicNG.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL