Class Control
Control object for the grounding/solving process.
Inheritance
Implements
Inherited Members
Namespace: ClingoSharp
Assembly: ClingoSharp.dll
Syntax
public sealed class Control : IDisposable
Constructors
| Improve this Doc View SourceControl(Control)
Declaration
public Control(Control clingoControl)
Parameters
Type | Name | Description |
---|---|---|
Control | clingoControl |
Control(List<String>, Action<MessageCode, String>, Int32)
Create a new Control object
Declaration
public Control(List<string> args = null, Action<MessageCode, string> logger = null, int messageLimit = 20)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.String> | args | Arguments to the grounder and solver. |
System.Action<MessageCode, System.String> | logger | Function to intercept messages normally printed to standard error. |
System.Int32 | messageLimit | The maximum number of messages passed to the logger. |
Properties
| Improve this Doc View SourceSymbolicAtoms
Declaration
public SymbolicAtoms SymbolicAtoms { get; }
Property Value
Type | Description |
---|---|
SymbolicAtoms |
Methods
| Improve this Doc View SourceAdd(String, List<String>, String)
Extend the logic program with the given non-ground logic program in string form.
Declaration
public void Add(string name, List<string> parameters, string program)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of program block to add. |
System.Collections.Generic.List<System.String> | parameters | The parameters of the program block to add. |
System.String | program | The non-ground program in string form. |
Dispose()
Declaration
public void Dispose()
Finalize()
Declaration
protected void Finalize()
GetControlModule()
Gets the control module in clingo
Declaration
public static IControlModule GetControlModule()
Returns
Type | Description |
---|---|
IControlModule | The control module |
GetModule()
Gets the asociated API module in clingo
Declaration
public static IClingoModule GetModule()
Returns
Type | Description |
---|---|
IClingoModule | The asociated module |
Ground(List<Tuple<String, List<Symbol>>>, Object)
Ground the given list of program parts specified by tuples of names and arguments.
Declaration
public void Ground(List<Tuple<string, List<Symbol>>> parts, object context = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.Tuple<System.String, System.Collections.Generic.List<Symbol>>> | parts | List of tuples of program names and program arguments to ground. |
System.Object | context |
Solve(List<Union<Tuple<Symbol, Boolean>, Int32>>, Func<Model, Boolean>, Action<StatisticsMap, StatisticsMap>, Action<SolveResult>, Boolean, Boolean)
Starts a search
Declaration
public Union<SolveHandle, SolveResult> Solve(List<Union<Tuple<Symbol, bool>, int>> assumptions = null, Func<Model, bool> onModel = null, Action<StatisticsMap, StatisticsMap> onStatistics = null, Action<SolveResult> onFinish = null, bool yield = false, bool async = false)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<Union<System.Tuple<Symbol, System.Boolean>, System.Int32>> | assumptions | List of (atom, boolean) tuples or program literals that serve as assumptions for the solve call, e.g., solving under assumptions |
System.Func<Model, System.Boolean> | onModel | Optional callback for intercepting models. A Model object is passed to the callback. The search can be interruped from the model callback by returning |
System.Action<StatisticsMap, StatisticsMap> | onStatistics | Optional callback to update statistics. The step and accumulated statistics are passed as arguments. |
System.Action<SolveResult> | onFinish | Optional callback called once search has finished. A SolveResult also indicating whether the solve call has been interrupted is passed to the callback. |
System.Boolean | yield | The resulting SolveHandle is iterable yielding Model objects. |
System.Boolean | async | The solve call and the method Resume() of the returned handle are non-blocking. |
Returns
Type | Description |
---|---|
Union<SolveHandle, SolveResult> | The return value depends on the parameters. If either yield or async is true, then a SolveHandle is returned. Otherwise, a SolveResult is returned. |
Operators
| Improve this Doc View SourceImplicit(Control to Control)
Declaration
public static implicit operator Control(Control control)
Parameters
Type | Name | Description |
---|---|---|
Control | control |
Returns
Type | Description |
---|---|
Control |
Implicit(Control to Control)
Declaration
public static implicit operator Control(Control clingoControl)
Parameters
Type | Name | Description |
---|---|---|
Control | clingoControl |
Returns
Type | Description |
---|---|
Control |