### Question:
BooleanMaxWalkSat implements Reasoner { @Override public void close() { } BooleanMaxWalkSat(); @Override void optimize(TermStore termStore); @Override void close(); static final String CONFIG_PREFIX; static final String MAX_FLIPS_KEY; static final int MAX_FLIPS_DEFAULT; static final String NOISE_KEY; static final double NOISE_DEFAULT; }### Answer:
@Test public void baseTest() { Set<StandardPredicate> toClose = new HashSet<StandardPredicate>(); Database inferDB = info.dataStore.getDatabase(info.targetPartition, toClose, info.observationPartition); MPEInference mpe = new MPEInference(info.model, inferDB); mpe.inference(); mpe.close(); inferDB.close(); }
@Test public void functionalConstraintTest() { List<Coefficient> coefficients = Arrays.asList( (Coefficient)(new ConstantNumber(1.0f)) ); List<SummationAtomOrAtom> atoms = Arrays.asList( (SummationAtomOrAtom)(new SummationAtom( info.predicates.get("Friends"), new SummationVariableOrTerm[]{new Variable("A"), new SummationVariable("B")} )) ); info.model.addRule(new UnweightedArithmeticRule( new ArithmeticRuleExpression(coefficients, atoms, FunctionComparator.EQ, new ConstantNumber(1.0f)) )); Set<StandardPredicate> toClose = new HashSet<StandardPredicate>(); Database inferDB = info.dataStore.getDatabase(info.targetPartition, toClose, info.observationPartition); MPEInference mpe = new MPEInference(info.model, inferDB); mpe.inference(); mpe.close(); inferDB.close(); }
@Test public void partialFunctionalConstraintTest() { List<Coefficient> coefficients = Arrays.asList( (Coefficient)(new ConstantNumber(1.0f)) ); List<SummationAtomOrAtom> atoms = Arrays.asList( (SummationAtomOrAtom)(new SummationAtom( info.predicates.get("Friends"), new SummationVariableOrTerm[]{new Variable("A"), new SummationVariable("B")} )) ); info.model.addRule(new UnweightedArithmeticRule( new ArithmeticRuleExpression(coefficients, atoms, FunctionComparator.LTE, new ConstantNumber(1.0f)) )); Set<StandardPredicate> toClose = new HashSet<StandardPredicate>(); Database inferDB = info.dataStore.getDatabase(info.targetPartition, toClose, info.observationPartition); MPEInference mpe = new MPEInference(info.model, inferDB); mpe.inference(); mpe.close(); inferDB.close(); }