001    package aima.test.search.searches;
002    
003    import junit.framework.TestCase;
004    import aima.search.informed.SimulatedAnnealingSearch;
005    
006    public class SimulatedAnnealingSearchTest extends TestCase {
007    
008            public void testForGivenNegativeDeltaEProbabilityOfAcceptanceDecreasesWithDecreasingTemperature() {
009                    // this isn't very nice. the object's state is uninitialized but is ok
010                    // for this test.
011                    SimulatedAnnealingSearch search = new SimulatedAnnealingSearch();
012                    int deltaE = -1;
013                    double higherTemperature = 30.0;
014                    double lowerTemperature = 29.5;
015    
016                    assertTrue(search.probabilityOfAcceptance(lowerTemperature, deltaE) < search
017                                    .probabilityOfAcceptance(higherTemperature, deltaE));
018            }
019    
020    }