Show / Hide Table of Contents

Class Model

Provides access to a model during a solve call and provides a SolveControl object to provided limited support to influence the running search.

Inheritance
System.Object
Model
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: ClingoSharp
Assembly: ClingoSharp.dll
Syntax
public sealed class Model

Constructors

| Improve this Doc View Source

Model(Model)

Declaration
public Model(Model clingoModel)
Parameters
Type Name Description
Model clingoModel

Properties

| Improve this Doc View Source

Context

Object that allows for controlling the running search.

Declaration
public SolveControl Context { get; }
Property Value
Type Description
SolveControl
| Improve this Doc View Source

Cost

Return the list of integer cost values of the model.

Declaration
public List<int> Cost { get; }
Property Value
Type Description
System.Collections.Generic.List<System.Int32>
| Improve this Doc View Source

Number

The running number of the model.

Declaration
public int Number { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

OptimalityProven

Whether the optimality of the model has been proven.

Declaration
public bool OptimalityProven { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

ThreadId

The id of the thread which found the model.

Declaration
public int ThreadId { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Type

The type of the model.

Declaration
public ModelType Type { get; }
Property Value
Type Description
ModelType

Methods

| Improve this Doc View Source

Contains(Symbol)

Efficiently check if an atom is contained in the model.

Declaration
public bool Contains(Symbol atom)
Parameters
Type Name Description
Symbol atom

The atom to lookup

Returns
Type Description
System.Boolean

Whether the given atom is contained in the model.

Remarks

The atom must be represented using a function symbol.

| Improve this Doc View Source

Extend(List<Symbol>)

Extend a model with the given symbols.

Declaration
public void Extend(List<Symbol> symbols)
Parameters
Type Name Description
System.Collections.Generic.List<Symbol> symbols

The symbols to add to the model.

| Improve this Doc View Source

GetSymbols(Boolean, Boolean, Boolean, Boolean, Boolean)

Return the list of atoms, terms, or CSP assignments in the model.

Declaration
public List<Symbol> GetSymbols(bool atoms = false, bool terms = false, bool shown = false, bool csp = false, bool complement = false)
Parameters
Type Name Description
System.Boolean atoms

Select all atoms in the model (independent of #show statements).

System.Boolean terms

Select all terms displayed with #show statements in the model.

System.Boolean shown

Select all atoms and terms as outputted by clingo.

System.Boolean csp

Select all csp assignments (independent of #show statements).

System.Boolean complement

Return the complement of the answer set w.r.t. to the atoms known to the grounder. (Does not affect csp assignments.)

Returns
Type Description
System.Collections.Generic.List<Symbol>

The selected symbols.

| Improve this Doc View Source

IsTrue(Int32)

Check if the given program literal is true.

Declaration
public bool IsTrue(int literal)
Parameters
Type Name Description
System.Int32 literal

The given program literal.

Returns
Type Description
System.Boolean

Whether the given program literal is true.

| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

Operators

| Improve this Doc View Source

Implicit(Model to Model)

Declaration
public static implicit operator Model(Model clingoModel)
Parameters
Type Name Description
Model clingoModel
Returns
Type Description
Model
| Improve this Doc View Source

Implicit(Model to Model)

Declaration
public static implicit operator Model(Model model)
Parameters
Type Name Description
Model model
Returns
Type Description
Model
  • Improve this Doc
  • View Source
Back to top Generated by DocFX