001    package aima.test.logictest.foltest;
002    
003    import aima.logic.fol.inference.FOLModelElimination;
004    
005    /**
006     * @author Ciaran O'Reilly
007     * 
008     */
009    public class FOLModelEliminationTest extends CommonFOLInferenceProcedureTests {
010    
011            public void testDefiniteClauseKBKingsQueryCriminalXFalse() {
012                    testDefiniteClauseKBKingsQueryCriminalXFalse(new FOLModelElimination());
013            }
014    
015            public void testDefiniteClauseKBKingsQueryRichardEvilFalse() {
016                    testDefiniteClauseKBKingsQueryRichardEvilFalse(new FOLModelElimination());
017            }
018    
019            public void testDefiniteClauseKBKingsQueryJohnEvilSucceeds() {
020                    testDefiniteClauseKBKingsQueryJohnEvilSucceeds(new FOLModelElimination());
021            }
022    
023            public void testDefiniteClauseKBKingsQueryEvilXReturnsJohnSucceeds() {
024                    testDefiniteClauseKBKingsQueryEvilXReturnsJohnSucceeds(new FOLModelElimination());
025            }
026    
027            public void testDefiniteClauseKBKingsQueryKingXReturnsJohnAndRichardSucceeds() {
028                    testDefiniteClauseKBKingsQueryKingXReturnsJohnAndRichardSucceeds(new FOLModelElimination());
029            }
030    
031            public void testDefiniteClauseKBWeaponsQueryCriminalXReturnsWestSucceeds() {
032                    testDefiniteClauseKBWeaponsQueryCriminalXReturnsWestSucceeds(new FOLModelElimination());
033            }
034    
035            public void testHornClauseKBRingOfThievesQuerySkisXReturnsNancyRedBertDrew() {
036                    // This KB ends up being infinite when resolving, however 2
037                    // seconds is more than enough to extract the 4 answers
038                    // that are expected
039                    testHornClauseKBRingOfThievesQuerySkisXReturnsNancyRedBertDrew(new FOLModelElimination(
040                                    2 * 1000));
041            }
042    
043            public void testFullFOLKBLovesAnimalQueryKillsCuriosityTunaSucceeds() {
044                    testFullFOLKBLovesAnimalQueryKillsCuriosityTunaSucceeds(
045                                    new FOLModelElimination(), false);
046            }
047    
048            public void testFullFOLKBLovesAnimalQueryNotKillsJackTunaSucceeds() {
049                    testFullFOLKBLovesAnimalQueryNotKillsJackTunaSucceeds(
050                                    new FOLModelElimination(), false);
051            }
052    
053            public void testFullFOLKBLovesAnimalQueryKillsJackTunaFalse() {
054                    // Note: While the KB expands infinitely, the answer
055                    // search for this bottoms out indicating the
056                    // KB does not entail the fact.
057                    testFullFOLKBLovesAnimalQueryKillsJackTunaFalse(
058                                    new FOLModelElimination(), false);
059            }
060    
061            public void testEqualityAxiomsKBabcAEqualsCSucceeds() {
062                    testEqualityAxiomsKBabcAEqualsCSucceeds(new FOLModelElimination());
063            }
064    
065            public void testEqualityAndSubstitutionAxiomsKBabcdFFASucceeds() {
066                    testEqualityAndSubstitutionAxiomsKBabcdFFASucceeds(new FOLModelElimination());
067            }
068    
069            public void testEqualityAndSubstitutionAxiomsKBabcdPDSucceeds() {
070                    xtestEqualityAndSubstitutionAxiomsKBabcdPDSucceeds(new FOLModelElimination());
071            }
072    
073            public void testEqualityAndSubstitutionAxiomsKBabcdPFFASucceeds() {
074                    testEqualityAndSubstitutionAxiomsKBabcdPFFASucceeds(
075                                    new FOLModelElimination(), false);
076            }
077    
078            public void testEqualityNoAxiomsKBabcAEqualsCSucceeds() {
079                    testEqualityNoAxiomsKBabcAEqualsCSucceeds(new FOLModelElimination(),
080                                    true);
081            }
082    
083            public void testEqualityAndSubstitutionNoAxiomsKBabcdFFASucceeds() {
084                    testEqualityAndSubstitutionNoAxiomsKBabcdFFASucceeds(
085                                    new FOLModelElimination(), true);
086            }
087    
088            public void testEqualityAndSubstitutionNoAxiomsKBabcdPDSucceeds() {
089                    testEqualityAndSubstitutionNoAxiomsKBabcdPDSucceeds(
090                                    new FOLModelElimination(), true);
091            }
092    
093            public void testEqualityAndSubstitutionNoAxiomsKBabcdPFFASucceeds() {
094                    testEqualityAndSubstitutionNoAxiomsKBabcdPFFASucceeds(
095                                    new FOLModelElimination(), true);
096            }
097    }