001 package aima.test.logictest.foltest; 002 003 import aima.logic.fol.inference.FOLTFMResolution; 004 005 /** 006 * @author Ciaran O'Reilly 007 * 008 */ 009 public class FOLTFMResolutionTest extends CommonFOLInferenceProcedureTests { 010 011 public void testDefiniteClauseKBKingsQueryCriminalXFalse() { 012 testDefiniteClauseKBKingsQueryCriminalXFalse(new FOLTFMResolution()); 013 } 014 015 public void testDefiniteClauseKBKingsQueryRichardEvilFalse() { 016 testDefiniteClauseKBKingsQueryRichardEvilFalse(new FOLTFMResolution()); 017 } 018 019 public void testDefiniteClauseKBKingsQueryJohnEvilSucceeds() { 020 testDefiniteClauseKBKingsQueryJohnEvilSucceeds(new FOLTFMResolution()); 021 } 022 023 public void testDefiniteClauseKBKingsQueryEvilXReturnsJohnSucceeds() { 024 testDefiniteClauseKBKingsQueryEvilXReturnsJohnSucceeds(new FOLTFMResolution()); 025 } 026 027 public void testDefiniteClauseKBKingsQueryKingXReturnsJohnAndRichardSucceeds() { 028 testDefiniteClauseKBKingsQueryKingXReturnsJohnAndRichardSucceeds(new FOLTFMResolution()); 029 } 030 031 public void testDefiniteClauseKBWeaponsQueryCriminalXReturnsWestSucceeds() { 032 testDefiniteClauseKBWeaponsQueryCriminalXReturnsWestSucceeds(new FOLTFMResolution()); 033 } 034 035 public void testHornClauseKBRingOfThievesQuerySkisXReturnsNancyRedBertDrew() { 036 // The clauses in this KB can keep creating resolvents infinitely, 037 // therefore give it 20 seconds to find the 4 answers to this, should 038 // be more than enough. 039 testHornClauseKBRingOfThievesQuerySkisXReturnsNancyRedBertDrew(new FOLTFMResolution( 040 40 * 1000)); 041 } 042 043 public void testFullFOLKBLovesAnimalQueryKillsCuriosityTunaSucceeds() { 044 // 10 seconds should be more than plenty for this query to finish. 045 testFullFOLKBLovesAnimalQueryKillsCuriosityTunaSucceeds( 046 new FOLTFMResolution(10 * 1000), false); 047 } 048 049 public void testFullFOLKBLovesAnimalQueryNotKillsJackTunaSucceeds() { 050 // 10 seconds should be more than plenty for this query to finish. 051 testFullFOLKBLovesAnimalQueryNotKillsJackTunaSucceeds( 052 new FOLTFMResolution(10 * 1000), false); 053 } 054 055 public void testFullFOLKBLovesAnimalQueryKillsJackTunaFalse() { 056 // This query will not return using TFM as keep expanding 057 // clauses through resolution for this KB. 058 testFullFOLKBLovesAnimalQueryKillsJackTunaFalse(new FOLTFMResolution( 059 10 * 1000), true); 060 } 061 062 public void testEqualityAxiomsKBabcAEqualsCSucceeds() { 063 testEqualityAxiomsKBabcAEqualsCSucceeds(new FOLTFMResolution(10 * 1000)); 064 } 065 066 public void testEqualityAndSubstitutionAxiomsKBabcdFFASucceeds() { 067 testEqualityAndSubstitutionAxiomsKBabcdFFASucceeds(new FOLTFMResolution( 068 40 * 1000)); 069 } 070 071 // Note: Requires VM arguments to be: 072 // -Xms256m -Xmx1024m 073 // due to the amount of memory it uses. 074 public void xtestEqualityAndSubstitutionAxiomsKBabcdPDSucceeds() { 075 xtestEqualityAndSubstitutionAxiomsKBabcdPDSucceeds(new FOLTFMResolution( 076 10 * 1000)); 077 } 078 079 public void testEqualityAndSubstitutionAxiomsKBabcdPFFASucceeds() { 080 // TFM is unable to find the correct answer to this in a reasonable 081 // amount of time for a JUnit test. 082 testEqualityAndSubstitutionAxiomsKBabcdPFFASucceeds( 083 new FOLTFMResolution(10 * 1000), true); 084 } 085 086 public void testEqualityNoAxiomsKBabcAEqualsCSucceeds() { 087 testEqualityNoAxiomsKBabcAEqualsCSucceeds(new FOLTFMResolution( 088 10 * 1000), true); 089 } 090 091 public void testEqualityAndSubstitutionNoAxiomsKBabcdFFASucceeds() { 092 testEqualityAndSubstitutionNoAxiomsKBabcdFFASucceeds( 093 new FOLTFMResolution(10 * 1000), true); 094 } 095 096 public void testEqualityAndSubstitutionNoAxiomsKBabcdPDSucceeds() { 097 testEqualityAndSubstitutionNoAxiomsKBabcdPDSucceeds( 098 new FOLTFMResolution(10 * 1000), true); 099 } 100 101 public void testEqualityAndSubstitutionNoAxiomsKBabcdPFFASucceeds() { 102 testEqualityAndSubstitutionNoAxiomsKBabcdPFFASucceeds( 103 new FOLTFMResolution(10 * 1000), true); 104 } 105 }