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
Inherited Members
Namespace: ClingoSharp
Assembly: ClingoSharp.dll
Syntax
public sealed class Model
Constructors
| Improve this Doc View SourceModel(Model)
Declaration
public Model(Model clingoModel)
Parameters
Type | Name | Description |
---|---|---|
Model | clingoModel |
Properties
| Improve this Doc View SourceContext
Object that allows for controlling the running search.
Declaration
public SolveControl Context { get; }
Property Value
Type | Description |
---|---|
SolveControl |
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> |
Number
The running number of the model.
Declaration
public int Number { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
OptimalityProven
Whether the optimality of the model has been proven.
Declaration
public bool OptimalityProven { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ThreadId
The id of the thread which found the model.
Declaration
public int ThreadId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Type
The type of the model.
Declaration
public ModelType Type { get; }
Property Value
Type | Description |
---|---|
ModelType |
Methods
| Improve this Doc View SourceContains(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.
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. |
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 |
System.Boolean | terms | Select all terms displayed with |
System.Boolean | shown | Select all atoms and terms as outputted by clingo. |
System.Boolean | csp | Select all csp assignments (independent of |
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. |
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. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Operators
| Improve this Doc View SourceImplicit(Model to Model)
Declaration
public static implicit operator Model(Model clingoModel)
Parameters
Type | Name | Description |
---|---|---|
Model | clingoModel |
Returns
Type | Description |
---|---|
Model |
Implicit(Model to Model)
Declaration
public static implicit operator Model(Model model)
Parameters
Type | Name | Description |
---|---|---|
Model | model |
Returns
Type | Description |
---|---|
Model |