Source:
<code><START> public double proposeNextState(PartialWorldDiff world, BayesNetVar var, <END> Object value) { if (evidence == null) { throw new IllegalStateException( "initialize() has not been called on proposer."); } logProbGibbs = 0; if (!(var instanceof VarWithDistrib)) { throw new IllegalStateException( "Try to sample a non-distribution variable in Gibbs Sampling."); } sampleValue((VarWithDistrib) var, value, world); if (Util.verbose()) { System.out.println("GenericProposer: world right before getting" + " newly barren vars.\n"); System.out.println(world); } Set evidenceAndQueryVars = new HashSet(); for (Iterator iter = evidenceVars.iterator(); iter.hasNext();) { BayesNetVar curVar = (BayesNetVar) iter.next(); if (curVar instanceof BasicVar) { evidenceAndQueryVars.add(curVar); } else if (curVar instanceof DerivedVar) { evidenceAndQueryVars.addAll(curVar.getParents(world)); } } for (Iterator iter = queryVars.iterator(); iter.hasNext();) { BayesNetVar curVar = (BayesNetVar) iter.next(); if (curVar instanceof BasicVar) { evidenceAndQueryVars.add(curVar); } else if (curVar instanceof DerivedVar) { evidenceAndQueryVars.addAll(curVar.getParents(world)); } } boolean OK; do { OK = true; for (Iterator iter = world.getInstantiatedVars().iterator(); iter .hasNext();) { BasicVar curVar = (BasicVar) iter.next(); PartialWorldDiff tmpWorld = new PartialWorldDiff(world); tmpWorld.setValue(curVar, null); if (evidenceAndQueriesSupported(evidenceAndQueryVars, tmpWorld)) { world.setValue(curVar, null); OK = false; logProbBackward += world.getSaved().getLogProbOfValue(curVar); } } } while (!OK); logProbGibbs += (-Math.log(world.getInstantiatedVars().size() - numBasicEvidenceVars)); return logProbGibbs; }</code><technical_language>is this in MHSampler well</technical_language>

Target:
public double proposeNextState(PartialWorldDiff world, BayesNetVar var, Object value) { if (evidence == null) { throw new IllegalStateException( "initialize() has not been called on proposer."); } logProbGibbs = 0; if (!(var instanceof VarWithDistrib)) { throw new IllegalStateException( "Try to sample a non-distribution variable in Gibbs Sampling."); } sampleValue((VarWithDistrib) var, value, world); if (Util.verbose()) { System.out.println("GenericProposer: world right before getting" + " newly barren vars.\n"); System.out.println(world); } Set evidenceAndQueryVars = new HashSet(); for (Iterator iter = evidenceVars.iterator(); iter.hasNext();) { BayesNetVar curVar = (BayesNetVar) iter.next(); if (curVar instanceof BasicVar) { evidenceAndQueryVars.add(curVar); } else if (curVar instanceof DerivedVar) { evidenceAndQueryVars.addAll(curVar.getParents(world)); } } for (Iterator iter = queryVars.iterator(); iter.hasNext();) { BayesNetVar curVar = (BayesNetVar) iter.next(); if (curVar instanceof BasicVar) { evidenceAndQueryVars.add(curVar); } else if (curVar instanceof DerivedVar) { evidenceAndQueryVars.addAll(curVar.getParents(world)); } } boolean OK; do { OK = true; for (Iterator iter = world.getInstantiatedVars().iterator(); iter .hasNext();) { BasicVar curVar = (BasicVar) iter.next(); PartialWorldDiff tmpWorld = new PartialWorldDiff(world); tmpWorld.setValue(curVar, null); if (evidenceAndQueriesAreSupported(evidenceAndQueryVars, tmpWorld)) { world.setValue(curVar, null); OK = false; logProbBackward += world.getSaved().getLogProbOfValue(curVar); } } } while (!OK); logProbGibbs += (-Math.log(world.getInstantiatedVars().size() - numBasicEvidenceVars)); return logProbGibbs; }