edu.udo.cs.ie.cowbots.logic.solver
Class DLV

Package class diagram package DLV
java.lang.Object
  extended by edu.udo.cs.ie.cowbots.logic.solver.DLV

public class DLV
extends java.lang.Object

the dlv wrapper class, based on the one found in KiMAS - Knowledge in Multi Agent Systems.


Nested Class Summary
(package private)  class DLV.ASWeight
          utility class, used by the parser to store answer set weights
 
Field Summary
(package private) static java.util.concurrent.atomic.AtomicInteger callCounter
           
protected  int cpuCount
           
protected  java.lang.String logpath
           
protected  boolean osLinux
           
protected  java.lang.String path2dlv
           
protected  boolean printTimings
           
protected static java.util.concurrent.Semaphore sem
           
protected  boolean useSemaphore
           
 
Constructor Summary
DLV(java.lang.String path)
           
 
Method Summary
private  java.lang.String computeDirection(ELPLiteral lit)
           
 java.util.List<AnswerSet> computeModels(ELP program, int maxmodels)
           
 java.util.List<AnswerSet> computeModels(SourceList input, java.lang.String options, int models)
           
 java.util.Set<ELPLiteral> computePlans(int maxint, TransitionSystem ts, java.lang.String savedAs)
          method used to compute plans from k planning language
protected  java.lang.String getRunCmdPrefix()
          auxiliary function that returns an empty string or a command for a task that runs dlv. on linux, taskset is choosen by default.
protected  java.util.Set<ELPLiteral> parseModel(java.lang.String s)
          simple parser function, extracts all literals from an answer set provided by dlv. if the empty answer set is found, an empty Set is returned.
protected  DLV.ASWeight parseWeight(java.lang.String s)
           
protected  java.util.List<java.lang.String> runDLVEx(java.lang.String cmdln, int maxAS, SourceList programs)
          main method used for running a answer set solver (external utility program) and parsing its output.
protected  java.util.List<java.lang.String> runDLVK(java.lang.String cmdln)
           
 void setLogPath(java.lang.String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

path2dlv

protected java.lang.String path2dlv

logpath

protected java.lang.String logpath

osLinux

protected boolean osLinux

callCounter

static java.util.concurrent.atomic.AtomicInteger callCounter

cpuCount

protected int cpuCount

printTimings

protected boolean printTimings

useSemaphore

protected boolean useSemaphore

sem

protected static java.util.concurrent.Semaphore sem
Constructor Detail

DLV

public DLV(java.lang.String path)
Method Detail

setLogPath

public void setLogPath(java.lang.String path)

computeModels

public java.util.List<AnswerSet> computeModels(ELP program,
                                               int maxmodels)

computeModels

public java.util.List<AnswerSet> computeModels(SourceList input,
                                               java.lang.String options,
                                               int models)

getRunCmdPrefix

protected java.lang.String getRunCmdPrefix()
auxiliary function that returns an empty string or a command for a task that runs dlv. on linux, taskset is choosen by default.

Returns:

runDLVEx

protected java.util.List<java.lang.String> runDLVEx(java.lang.String cmdln,
                                                    int maxAS,
                                                    SourceList programs)
main method used for running a answer set solver (external utility program) and parsing its output. this is a modified version of the computeModels code from the dlv class found in KiMAS - Knowledge in Multi Agent Systems, credits to I. Drobiazko for writing original code.

Parameters:
cmdln - command to run dlv
maxAS - maximum number of answer sets
prog - program to pass via stdin (-- option)

parseModel

protected java.util.Set<ELPLiteral> parseModel(java.lang.String s)
simple parser function, extracts all literals from an answer set provided by dlv. if the empty answer set is found, an empty Set is returned.

Parameters:
s - answer set from dlv
Returns:
set of literals

parseWeight

protected DLV.ASWeight parseWeight(java.lang.String s)

computePlans

public java.util.Set<ELPLiteral> computePlans(int maxint,
                                              TransitionSystem ts,
                                              java.lang.String savedAs)
method used to compute plans from k planning language

Parameters:
ts - TODO
savedAs - TODO

computeDirection

private java.lang.String computeDirection(ELPLiteral lit)

runDLVK

protected java.util.List<java.lang.String> runDLVK(java.lang.String cmdln)