Class InconsistencyMeasureEvaluator<T extends Formula,U extends BeliefSet<T,?>>

java.lang.Object
org.tweetyproject.logics.commons.analysis.InconsistencyMeasureEvaluator<T,U>
Type Parameters:
T - The type of formulas belief sets are made of
U - The type of belief sets that are evaluated

public class InconsistencyMeasureEvaluator<T extends Formula,U extends BeliefSet<T,?>> extends Object
This class provides functionality to quickly load or generate sample datasets and to use them to compare the results and performances of different inconsistency measure implementations.
Author:
Anna Gessler
  • Constructor Details

    • InconsistencyMeasureEvaluator

      public InconsistencyMeasureEvaluator()
      Create a new empty InconsistencyMeasureEvaluator.
    • InconsistencyMeasureEvaluator

      public InconsistencyMeasureEvaluator(BeliefSetInconsistencyMeasure<T> i)
      Create a new InconsistencyMeasureEvaluator with the given inconsistency measure.
      Parameters:
      i - an inconsistency measure
    • InconsistencyMeasureEvaluator

      public InconsistencyMeasureEvaluator(Collection<BeliefSetInconsistencyMeasure<T>> measures)
      Create a new InconsistencyMeasureEvaluator with the given inconsistency measures.
      Parameters:
      measures - some inconsistency measures
    • InconsistencyMeasureEvaluator

      public InconsistencyMeasureEvaluator(Collection<U> dataset, BeliefSetInconsistencyMeasure<T> i)
      Create a new InconsistencyMeasureEvaluator with the given dataset and the given inconsistency measure.
      Parameters:
      dataset - collection of belief bases
      i - an inconsistency measure
    • InconsistencyMeasureEvaluator

      public InconsistencyMeasureEvaluator(Collection<U> dataset, Collection<BeliefSetInconsistencyMeasure<T>> measures)
      Create a new InconsistencyMeasureEvaluator with the given dataset and the given inconsistency measures.
      Parameters:
      dataset - collection of belief bases
      measures - some inconsistency measures
  • Method Details

    • addInconsistencyMeasure

      public void addInconsistencyMeasure(BeliefSetInconsistencyMeasure<T> i)
      Adds the given inconsistency measure.
      Parameters:
      i - BeliefSetInconsistencyMeasure
    • setTimeFunction

      public void setTimeFunction(Supplier<Long> timeFunction)
      Sets the function used to measure time in ms.
      Parameters:
      timeFunction - some time function
    • setTimeout

      public void setTimeout(long timeout)
      Sets the timeout.
      Parameters:
      timeout - in ms, must be non-negative
    • addKnowledgeBase

      public void addKnowledgeBase(U kb)
      Adds the given knowledge base to the testing dataset.
      Parameters:
      kb - knowledge base
    • addKnowledgeBases

      public void addKnowledgeBases(List<U> kbs)
      Adds the given knowledge bases to the testing dataset.
      Parameters:
      kbs - knowledge bases
    • parseDatasetFromPath

      public void parseDatasetFromPath(String path, Parser<U,T> p, int n) throws FileNotFoundException, ParserException, IOException
      Parse all knowledge bases from files in the given folder and add them to the testing dataset.
      Parameters:
      path - that contains knowledge bases (one knowledge base per file)
      p - appropriate parser for the format the knowledge bases are saved in (i.e. DimacsParser for files in Dimacs format, PlParser for files in TweetyProject pl Syntax)
      n - maximum number of knowledge bases to parse
      Throws:
      IOException - if some error occurs
      ParserException - if some error occurs
      FileNotFoundException - if some error occurs
    • addFromSampler

      public void addFromSampler(Iterator<U> sampler, int n)
      Add n knowledge bases from the given iterator (e.g., a random sampler) to the testing dataset.
      Parameters:
      sampler - some sampler
      n - how many knowledge bases will be added at most
    • compareMeasures

      public InconsistencyMeasureReport<T,U> compareMeasures()
      Computes inconsistency values for all belief bases in the dataset using all inconsistency measures and returns a report of the results.
      Returns:
      InconsistencyMeasureReport
    • getDataset

      public List<U> getDataset()
      Returns:
      the dataset of this evaluator
    • getDatasetWithNames

      public List<Pair<String,U>> getDatasetWithNames()
      Returns:
      the dataset of this evaluator, where each entry is the (file-)name and the corresponding kb