Class MlnExample

java.lang.Object
org.tweetyproject.logics.mln.examples.MlnExample

public class MlnExample extends Object
Shows how MLNs can be constructed programmatically and shows how coherence measures can be used.
Author:
Matthias Thimm
  • Constructor Details

    • MlnExample

      public MlnExample()
      Default constructor for the MlnExample class.

      Initializes an instance of the MLN example class to demonstrate the construction and analysis of Markov Logic Networks.

  • Method Details

    • SmokersExample

      public static Pair<MarkovLogicNetwork,FolSignature> SmokersExample(int domain_size) throws ParserException, IOException
      Constructs the Smokers Example MLN with a given domain size.
      Parameters:
      domain_size - the number of individuals in the domain
      Returns:
      a Pair consisting of the constructed Markov Logic Network and its FolSignature
      Throws:
      ParserException - if there is an error during parsing
      IOException - if there is an I/O error
    • ElephantZooExample

      public static Pair<MarkovLogicNetwork,FolSignature> ElephantZooExample(int domain_size) throws ParserException, IOException
      Constructs the Elephant Zoo Example MLN with a given domain size.
      Parameters:
      domain_size - the number of individuals in the domain
      Returns:
      a Pair consisting of the constructed Markov Logic Network and its FolSignature
      Throws:
      ParserException - if there is an error during parsing
      IOException - if there is an I/O error
    • CommonColdExample

      public static Pair<MarkovLogicNetwork,FolSignature> CommonColdExample(int domain_size) throws ParserException, IOException
      Constructs the Common Cold MLN with a given domain size.
      Parameters:
      domain_size - the number of individuals in the domain
      Returns:
      a Pair consisting of the constructed Markov Logic Network and its FolSignature
      Throws:
      ParserException - if there is an error during parsing
      IOException - if there is an I/O error
    • SimpleExample

      public static Pair<MarkovLogicNetwork,FolSignature> SimpleExample(int domain_size) throws ParserException, IOException
      Constructs the Simple Example MLN with a given domain size.
      Parameters:
      domain_size - the number of individuals in the domain
      Returns:
      a Pair consisting of the constructed Markov Logic Network and its FolSignature
      Throws:
      ParserException - if there is an error during parsing
      IOException - if there is an I/O error
    • iterateExamples

      public static Pair<MarkovLogicNetwork,FolSignature> iterateExamples(int exNum, int domain_size) throws ParserException, IOException
      Generates a pair of a MarkovLogicNetwork and a FolSignature based on the example number.
      Parameters:
      exNum - The example number to select the example to generate.
      domain_size - The size of the domain for the example.
      Returns:
      A Pair containing a MarkovLogicNetwork and a FolSignature for the selected example.
      Throws:
      ParserException - If there is an error parsing the example.
      IOException - If there is an I/O error.
    • main

      public static void main(String[] args) throws ParserException, IOException
      Main method to demonstrate the usage of coherence measures on different MLN examples.

      This method iterates through a set of examples, computes coherence measures for each MLN using different aggregating norms and aggregators, and prints the results.

      Parameters:
      args - command-line arguments (not used in this example)
      Throws:
      ParserException - if there is an error during parsing
      IOException - if there is an I/O error