Clone wiki

AlchemyMLN2TuffyMLN / Home


AlchemyMLN2TuffyMLN is a utility for converting an Alchemy Markov Logic Network to a Tuffy Markov Logic Network, by grounding terms preceded by +.

Its purpose is to facilitate weight learning using Tuffy.

Latest version

Version 0.0.1 is the latest version and can be downloaded here:

Bug reports, questions, feature requests, etc., can be sent to Oscar Sjöberg.


Supported in v. 0.0.1:

  • The following connectives: negation, conjunction, disjunction, implication, equivalence.
  • Equalities.
  • Soft and hard weights.
  • Atoms.
  • Parentheses.
  • Line comments (initiated by //).

Not supported as of yet:

  • Currently it does not support the Alchemy constraints specified using the '!' trailing variables in predicate declarations (it will not fail, but it removes all '!' from the predicate declarations). So these constraints on predicates will have to be written by hand unfortunately.
  • It does not support block comments (initiated and closed by /*, */).



$ python input_mln evidence_db output_mln

Or, (if is executable) you can run it by:

$ ./ input_mln evidence_db output_mln

where input_mln is the filename of the Markov Logic Network, in Alchemy format, that you want to convert, where evidence_db is the filename of the evidence database, that you want to use for grounding the variables marked by a leading +, and where output_mln is the filename of the file, which the grounded, Tuffy compliant Markov Logic Network will be written to.

Manual replacement of '!' constraints

An example from the Tuffy technical report will be used:

For a Markov Logic Network in Alchemy format, the constraint that a paper should belong to only one category, can be specified in the predicate declaration:

cat(paper, category!)

In Tuffy, the equivalent way of writing the constraint, would be to add the following formula:

cat(p, c1), cat(p, c2) => c1 = c2.

which specifies that the only time any paper p belongs to any categories c1 and c2 at the same time, is if c1 and c2 are the same category.