java.lang.Object
org.tweetyproject.logics.commons.analysis.InconsistencyMeasureEvaluator<T,U>
- Type Parameters:
T
- The type of formulas belief sets are made ofU
- 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 Summary
ConstructorDescriptionCreate a new empty InconsistencyMeasureEvaluator.Create a new InconsistencyMeasureEvaluator with the given inconsistency measures.InconsistencyMeasureEvaluator
(Collection<U> dataset, Collection<BeliefSetInconsistencyMeasure<T>> measures) Create a new InconsistencyMeasureEvaluator with the given dataset and the given inconsistency measures.InconsistencyMeasureEvaluator
(Collection<U> dataset, BeliefSetInconsistencyMeasure<T> i) Create a new InconsistencyMeasureEvaluator with the given dataset and the given inconsistency measure.Create a new InconsistencyMeasureEvaluator with the given inconsistency measure. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFromSampler
(Iterator<U> sampler, int n) Add n knowledge bases from the given iterator (e.g., a random sampler) to the testing dataset.void
Adds the given inconsistency measure.void
addKnowledgeBase
(U kb) Adds the given knowledge base to the testing dataset.void
addKnowledgeBases
(List<U> kbs) Adds the given knowledge bases to the testing dataset.Computes inconsistency values for all belief bases in the dataset using all inconsistency measures and returns a report of the results.void
parseDatasetFromPath
(String path, Parser<U, T> p, int n) Parse all knowledge bases from files in the given folder and add them to the testing dataset.void
setTimeFunction
(Supplier<Long> timeFunction) Sets the function used to measure time in ms.void
setTimeout
(long timeout) Sets the timeout.
-
Constructor Details
-
InconsistencyMeasureEvaluator
public InconsistencyMeasureEvaluator()Create a new empty InconsistencyMeasureEvaluator. -
InconsistencyMeasureEvaluator
Create a new InconsistencyMeasureEvaluator with the given inconsistency measure.- Parameters:
i
- an inconsistency measure
-
InconsistencyMeasureEvaluator
Create a new InconsistencyMeasureEvaluator with the given inconsistency measures.- Parameters:
measures
- some inconsistency measures
-
InconsistencyMeasureEvaluator
Create a new InconsistencyMeasureEvaluator with the given dataset and the given inconsistency measure.- Parameters:
dataset
- collection of belief basesi
- 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 basesmeasures
- some inconsistency measures
-
-
Method Details
-
addInconsistencyMeasure
Adds the given inconsistency measure.- Parameters:
i
- BeliefSetInconsistencyMeasure
-
setTimeFunction
-
setTimeout
public void setTimeout(long timeout) Sets the timeout.- Parameters:
timeout
- in ms, must be non-negative
-
addKnowledgeBase
Adds the given knowledge base to the testing dataset.- Parameters:
kb
- knowledge base
-
addKnowledgeBases
-
parseDatasetFromPath
public void parseDatasetFromPath(String path, Parser<U, T> p, int n) throws FileNotFoundException, ParserException, IOExceptionParse 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 occursParserException
- if some error occursFileNotFoundException
- if some error occurs
-
addFromSampler
-
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
-
getDatasetWithNames
-