es.upv.dsic.gti_ia.argAgents.domainCBR
Class DomainCBR

java.lang.Object
  extended by es.upv.dsic.gti_ia.argAgents.domainCBR.DomainCBR

public class DomainCBR
extends Object

This class implements the domain CBR. This CBR stores domain knowledge of previously solved problems. It is used by the argumentative agent to generate and select the Position (solution) to defend in an argumentation dialogue.

Author:
Jaume Jordan

Constructor Summary
DomainCBR(String filePath, String storingFilePath, int index)
          Constructor of the DomainCBR.
 
Method Summary
 boolean addCase(DomainCase newCase)
          Adds a new domain-case to domain case-base.
 void doCache()
          Stores the current domain-cases case-base to the storing file path
 void doCacheInc()
          Stores the current domain-cases case-base to the storing file path, but keeping the contents of that file
 Collection<ArrayList<DomainCase>> getAllCases()
          Returns all cases in a Collection of ArrayLists
 ArrayList<DomainCase> getAllCasesList()
          Returns all domain-cases in an ArrayList
 Vector<DomainCase> getAllCasesVector()
          Returns all domain-cases in a Vector
 float getPremisesSimilarity(HashMap<Integer,Premise> premises1, HashMap<Integer,Premise> premises2)
          Obtains the similarity between two HashMap of premises using the similarity algorithm specified in the configuration of this class.
 ArrayList<SimilarDomainCase> retrieve(HashMap<Integer,Premise> premises, float threshold)
          Retrieves the most similar domain-cases to the given premises with a similarity degree greater or equal than a given threshold.
 ArrayList<SimilarDomainCase> retrieveAndRetain(DomainCase domCase, float threshold)
          Retrieves the most similar domain-cases to the given one with a similarity degree greater or equal than a given threshold.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainCBR

public DomainCBR(String filePath,
                 String storingFilePath,
                 int index)
Constructor of the DomainCBR. Initializes the structures and loads the cases of the given data filePath. It also establishes the storingFilePath to the case-base.

Parameters:
filePath - path of the file to load the initial domain-cases
storingFilePath - path of the file to store the final domain-cases
index - identifier of the premise which value will be used as a hash index. If no indexation is used, just set this value to -1
Method Detail

retrieveAndRetain

public ArrayList<SimilarDomainCase> retrieveAndRetain(DomainCase domCase,
                                                      float threshold)
Retrieves the most similar domain-cases to the given one with a similarity degree greater or equal than a given threshold. Also, it retains a new domain-case if the premises of the domain-case are not exactly the same of any existent domain-case in the case-base.

Parameters:
domCase - The domain-case (representing a problem to solve) that needs a solution from the CBR
threshold - The threshold of minimum degree of similarity of the domain-cases to return
Returns:
an ArrayList of SimilarDomainCase

retrieve

public ArrayList<SimilarDomainCase> retrieve(HashMap<Integer,Premise> premises,
                                             float threshold)
Retrieves the most similar domain-cases to the given premises with a similarity degree greater or equal than a given threshold.

Parameters:
premises - HashMap of premises that describe the problem to solve
threshold - The threshold of minimum degree of similarity of the domain-cases to return
Returns:
an ArrayList of SimilarDomainCase

addCase

public boolean addCase(DomainCase newCase)
Adds a new domain-case to domain case-base. Otherwise, if the same domain-case exists in the case-base, adds the relevant data to the existing domain-case.

Parameters:
newCase - DomainCase that could be added.
Returns:
true if the domain-case is added, else false.

getPremisesSimilarity

public float getPremisesSimilarity(HashMap<Integer,Premise> premises1,
                                   HashMap<Integer,Premise> premises2)
Obtains the similarity between two HashMap of premises using the similarity algorithm specified in the configuration of this class.

Parameters:
premises1 - HashMap of premises 1
premises2 - HashMap of premises 2
Returns:
float with the similarity

doCache

public void doCache()
Stores the current domain-cases case-base to the storing file path


doCacheInc

public void doCacheInc()
Stores the current domain-cases case-base to the storing file path, but keeping the contents of that file


getAllCases

public Collection<ArrayList<DomainCase>> getAllCases()
Returns all cases in a Collection of ArrayLists

Returns:
all cases in a Collection of ArrayLists

getAllCasesList

public ArrayList<DomainCase> getAllCasesList()
Returns all domain-cases in an ArrayList

Returns:
all domain-cases in an ArrayList

getAllCasesVector

public Vector<DomainCase> getAllCasesVector()
Returns all domain-cases in a Vector

Returns:
all domain-cases in a Vector


Copyright © 2012 GTI-IA. All Rights Reserved.