somdeb / magician

0 stars 1 forks source link

Creating a GroundStore and Accessing a ground atom #10

Closed somdeb closed 9 years ago

somdeb commented 9 years ago

GroundStore: A storage for ground atoms

A factory method is needed to instantiate the ground store from an MLN using the closed world assumption .

Ground Atom Id: An exposed method will provide the ground atom id of a Predicate given assignment to its terms (list of integers)

somdeb commented 9 years ago

@tuanh118 : Issue fixed. Please refer sample method calls

Ground Store creation : A new method has been added. Usage:

String mlnFile = "love_mln.txt";
String dbFile = "love_mln_db.txt";

GroundStore gs = GroundStoreFactory.createGraphModBasedGroundStore(mlnFile, dbFile);
// Use gs to do all the stuff like count number of true grounding flip atom etc

Ground Atom Id : A new method has been added. Usage:

// Frist get hold of a ground store gs
GroundStore gs = ...;

// Form the assignments to variables or term constants (e.g {0,2} for R(0,2)
List<Integer> termConstatnts = ...;

// Get the predicate symbol (in our example R
PredicateSymbol symbol = ...;

int atomId = gs.getGroundAtomId(symbol, termConstatnts);
// Use atomId to flip atoms etc.