### Question:
SimulatedAnnealing { public NetworkState getMaxAPosteriori(ProbabilisticModel model, int sampleCount) { AnnealingSchedule schedule = exponentialSchedule(sampleCount, 2, 0.01); return getMaxAPosteriori(model, sampleCount, schedule); }  static SimulatedAnnealingBuilder builder(); NetworkState getMaxAPosteriori(ProbabilisticModel model,
                                          int sampleCount); NetworkState getMaxAPosteriori(ProbabilisticModel model,
                                          int sampleCount,
                                          AnnealingSchedule annealingSchedule); static AnnealingSchedule exponentialSchedule(int iterations, double startT, double endT);  }### Answer:
@Test public void findsMaxAposterioriWithAnnealing() { BayesianNetwork network = new BayesianNetwork(A.getConnectedGraph()); network.probeForNonZeroProbability(100, random); KeanuProbabilisticModel model = new KeanuProbabilisticModel(network); NetworkState maxAPosterioriSamples = Keanu.Sampling.SimulatedAnnealing.withDefaultConfig(random).getMaxAPosteriori(model, 10000); NetworkState maxValuesFromVariational = findMAPWithOptimizer(); assertEquals(maxValuesFromVariational.get(A).scalar(), maxAPosterioriSamples.get(A).scalar(), 0.05); assertEquals(maxValuesFromVariational.get(B).scalar(), maxAPosterioriSamples.get(B).scalar(), 0.05); }