Module clingo.core

Core functionality used throught the clingo package.

Functions

def version() ‑> Tuple[int, int, int]
Expand source code
def version() -> Tuple[int, int, int]:
    """
    Clingo's version as a tuple `(major, minor, revision)`.
    """
    p_major = _ffi.new("int*")
    p_minor = _ffi.new("int*")
    p_revision = _ffi.new("int*")
    _lib.clingo_version(p_major, p_minor, p_revision)
    return p_major[0], p_minor[0], p_revision[0]

Clingo's version as a tuple (major, minor, revision).

Classes

class MessageCode (*args, **kwds)
Expand source code
class MessageCode(OrderedEnum):
    """
    Enumeration of messages codes.
    """

    AtomUndefined = _lib.clingo_warning_atom_undefined
    """
    Informs about an undefined atom in program.
    """
    FileIncluded = _lib.clingo_warning_file_included
    """
    Indicates that the same file was included multiple times.
    """
    GlobalVariable = _lib.clingo_warning_global_variable
    """
    Informs about a global variable in a tuple of an aggregate element.
    """
    OperationUndefined = _lib.clingo_warning_operation_undefined
    """
    Inform about an undefined arithmetic operation or unsupported weight of an
    aggregate.
    """
    Other = _lib.clingo_warning_other
    """
    Reports other kinds of messages.
    """
    RuntimeError = _lib.clingo_warning_runtime_error
    """
    To report multiple errors; a corresponding runtime error is raised later.
    """
    VariableUnbounded = _lib.clingo_warning_variable_unbounded
    """
    Informs about a CSP variable with an unbounded domain.
    """

Enumeration of messages codes.

Ancestors

Class variables

var AtomUndefined

Informs about an undefined atom in program.

var FileIncluded

Indicates that the same file was included multiple times.

var GlobalVariable

Informs about a global variable in a tuple of an aggregate element.

var OperationUndefined

Inform about an undefined arithmetic operation or unsupported weight of an aggregate.

var Other

Reports other kinds of messages.

var RuntimeError

To report multiple errors; a corresponding runtime error is raised later.

var VariableUnbounded

Informs about a CSP variable with an unbounded domain.

class OrderedEnum (*args, **kwds)
Expand source code
class OrderedEnum(Enum):
    """
    Enumeration of orderable elements.
    """

    def __ge__(self, other):
        if self.__class__ is other.__class__:
            return self.value >= other.value
        return NotImplemented

    def __gt__(self, other):
        if self.__class__ is other.__class__:
            return self.value > other.value
        return NotImplemented

    def __le__(self, other):
        if self.__class__ is other.__class__:
            return self.value <= other.value
        return NotImplemented

    def __lt__(self, other):
        if self.__class__ is other.__class__:
            return self.value < other.value
        return NotImplemented

Enumeration of orderable elements.

Ancestors

  • enum.Enum

Subclasses

class TruthValue (*args, **kwds)
Expand source code
class TruthValue(OrderedEnum):
    """
    Enumeration of the different truth values.
    """

    False_ = _lib.clingo_external_type_false
    """
    Represents truth value true.
    """
    Free = _lib.clingo_external_type_free
    """
    Represents absence of a truth value.
    """
    True_ = _lib.clingo_external_type_true
    """
    Represents truth value true.
    """
    Release = _lib.clingo_external_type_release
    """
    Indicates that an atom is to be released.
    """

Enumeration of the different truth values.

Ancestors

Class variables

var False_

Represents truth value true.

var Free

Represents absence of a truth value.

var Release

Indicates that an atom is to be released.

var True_

Represents truth value true.