edu.iu.pcl.absurdist.absurdist
Class Absurdist

java.lang.Object
  |
  +--edu.iu.pcl.absurdist.absurdist.Absurdist

public class Absurdist
extends java.lang.Object

Class Absurdist provides the ABSURDIST II graph matching algorithms to compute the correspondence between two concept systems, and finds the optimal mappings between them. The behavior of this class is affected by a number of parameters, which can be supplied as Java System Properties on the command line (java -Dname=value ...). For example, running java -DresetL=false -DL=0.01 -DmaxLoop=5000 driver.ApplicDriver will run the program with fixed L equal to 0.01, interrupting the loop at the 5000-th iteration, if the convergence has not been achieved. java -DresetL=true driver.ApplicDriver will adjust the learning rate at every step to 1/2 of the maximum safe rate. This is supposed to achieve fastest convergence. One can find all the parameters in the code by searching for 'prop.getOption'.


Nested Class Summary
static class Absurdist.Results
          Used for reporting.
 
Field Summary
static boolean adjBest
          If true, we'll find the optimal permutation (this may be very expensive!)
 double alpha
          Coefficients for external similarity.
static double alphaShare
          This flag determines the alpha/(alpha+beta) ratio to be used in adjustCoeff(); it only is used if useAlphaShare is true, and is ignored otherwise.
 double beta
          Coefficients for activation.
 double chi
          Coefficients for inhibition.
static double cInit
          Intitial value for correspondence matrix.
static int coefMode
          This parameter controls how chi and beta are initially set, and whether they are reset during the iterative process.
static int CONVERGED
          Concept systems mapping iteration converged.
 double[][][] correspond
          Correspondence matrix C[step][row][col].
static int CREATED
          Concept system created.
static double cvgThresh
          Threshold for iteration convergence.
static int dampingMode
          Damping mode.
static boolean enforce1to1map
          If true, 1-1 mapping will be enforced.
 double[][] exSim
          External similarity E[row][col].
 double[][][] inhib
          Inhibitor I[step][row][col].
static int INITIAL
          Initial status without concept system created.
 double[][][] inSim
          Internal similarity, also called activator, R[step][row][col].
static int intLoop
          Sampling interval for plots.
static int ITERATING
          Concept systems in mapping iteration.
static double lRate
          Learning rate (this may be adjusted if resetL=true).
 int[] mapNO
          Mappings from systemN to systemO, recording indices of matched concepts.
 int[] mapON
          Mappings from systemO to systemN, recording indices of matched concepts.
static int MAPPED
          Concept systems mapping completed.
static double mapThresh
          Threshold for valid mapping.
static double maxL
          The ceiling for adjustable learning rate.
static int maxLoop
          Maximum number of iterations.
 double[][][] netIn
          Network input N[step][row][col].
 int nStep
          Actual number of steps being recorded during network iteration.
static ParseConfig prop
          An empty property list -- just an interface to system properties
static boolean resetL
          If true, we recompute the learning rate at each step, for fastest convergence.
 Absurdist.Results results
           
 int status
          Status of the system.
 ConceptSystem systemN
          Target system for mapping.
 ConceptSystem systemO
          Source system for mapping.
 boolean systemsAreSimple
          This will be set to true in the constructor if both concept systems being matched are "binary", that is have no other relationship weights than 1 and 0.
 boolean useAlphaShare
          If true, the alphaShare parameter is used to set alpha via beta.
 boolean useAnchors
          If true, use anchors overlap for external similarity
static boolean useExponential
          If true, use the exponential version of activator and inhibitor to compute netwoek input.
static boolean useFastGeneral
          If true, use the "fast" (N^2 D^2) method for general (labeled, weighted) graphs.
 
Constructor Summary
Absurdist()
          Creates an empty absurdist system.
Absurdist(ConceptSystem systemO, ConceptSystem systemN)
          Creates an absurdist system containing the source and target concept systems and random external similarities.
 
Method Summary
 double calcLinkSim(Link lo, Link ln)
          Computes the similarity between the two links.
 void evalMap()
          Evaluates the quality of the mapping in mapON[].
 void initExSim()
          Initialize external similarity matrix to all 0's.
 boolean isConverged()
          Returns true if the network iteration is converged; otherwise false.
 boolean isCreated()
          Returns true if the two systems are already created; otherwise false.
 boolean isInitial()
          Returns true if the two systems have not yet been created; otherwise false.
 boolean isIterating()
          Returns true if the network iteration is going on; otherwise false.
 boolean isMapped()
          Returns true if the two systems are already mapped; otherwise false.
static Absurdist loadSystems(java.lang.String fileName, int w, int h)
          Creates a new instance of Absurdist initialized with the 2 systems read from a file containing Java serialized objects.
 void mapSystem()
          Maps orginal concept system to the one with added noise, using exponenital/linear activator/inhibitor.
 void print()
          Prints the source and target concept systems, the correspondence matrix, and the final mappings.
 void printCorrespond()
          Prints the correspondence matrix to the standard output.
 void printExSim()
          Prints the external similarity matrix to the standard output.
 void printMap()
          Prints the mapping between systemO and systemN to the standard output.
 void printSystems()
          Prints the two systems to the standard output.
 void readjustChi(double[][] exSim, double[][] inSim, double[][] inhib)
          A normalization method that takes both exSim and inSim into account.
 void saveSystems(java.lang.String fileName)
          Writes out the concept systems as Java serialized objects intoa file.
 void setSystemN(ConceptSystem systemN)
          Sets the target concepts system to be mapped to.
 void setSystemO(ConceptSystem systemO)
          Sets the source concepts system to be mapped from.
 void setSystems(ConceptSystem systemO, ConceptSystem systemN)
          Sets the two concepts systems for mapping.
 double sumElem(double[][] a)
          Computes the sum of the elements in an array.
static void turnOffHistory()
          Turn off the iteration history recording so that less memory will be used.
 void writeCorrespond(java.lang.String filename)
          Writes the correspondence matrix to a text file.
 void writeMap(java.lang.String filename)
          Writes the mapping between systemO and systemN to a text file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prop

public static ParseConfig prop
An empty property list -- just an interface to system properties


INITIAL

public static final int INITIAL
Initial status without concept system created.

See Also:
Constant Field Values

CREATED

public static final int CREATED
Concept system created.

See Also:
Constant Field Values

ITERATING

public static final int ITERATING
Concept systems in mapping iteration.

See Also:
Constant Field Values

CONVERGED

public static final int CONVERGED
Concept systems mapping iteration converged.

See Also:
Constant Field Values

MAPPED

public static final int MAPPED
Concept systems mapping completed.

See Also:
Constant Field Values

cInit

public static double cInit
Intitial value for correspondence matrix.


lRate

public static double lRate
Learning rate (this may be adjusted if resetL=true).


maxLoop

public static int maxLoop
Maximum number of iterations.


intLoop

public static int intLoop
Sampling interval for plots.


cvgThresh

public static double cvgThresh
Threshold for iteration convergence.


mapThresh

public static double mapThresh
Threshold for valid mapping.


coefMode

public static int coefMode
This parameter controls how chi and beta are initially set, and whether they are reset during the iterative process.


resetL

public static boolean resetL
If true, we recompute the learning rate at each step, for fastest convergence. (For compatibility with the 2003 code, set the default to false!)


maxL

public static double maxL
The ceiling for adjustable learning rate. If 0 or negative, it is ignored


dampingMode

public static int dampingMode
Damping mode. Should be 0 (= G & R 2002) or 1 (= Hard damping)


useFastGeneral

public static boolean useFastGeneral
If true, use the "fast" (N^2 D^2) method for general (labeled, weighted) graphs.


useExponential

public static boolean useExponential
If true, use the exponential version of activator and inhibitor to compute netwoek input.


enforce1to1map

public static boolean enforce1to1map
If true, 1-1 mapping will be enforced.


adjBest

public static boolean adjBest
If true, we'll find the optimal permutation (this may be very expensive!) and compare the quality of our permutation to it


systemsAreSimple

public boolean systemsAreSimple
This will be set to true in the constructor if both concept systems being matched are "binary", that is have no other relationship weights than 1 and 0. If this is the case, we can use faster algorithms for computing inhibition, excitation, etc.


useAnchors

public boolean useAnchors
If true, use anchors overlap for external similarity


useAlphaShare

public boolean useAlphaShare
If true, the alphaShare parameter is used to set alpha via beta. This is false by default.


alphaShare

public static double alphaShare
This flag determines the alpha/(alpha+beta) ratio to be used in adjustCoeff(); it only is used if useAlphaShare is true, and is ignored otherwise. If it is 1.0, then alpha will be set to 1.0 and beta to 0.

See Also:
#adjustCoeff

alpha

public double alpha
Coefficients for external similarity.


beta

public double beta
Coefficients for activation.


chi

public double chi
Coefficients for inhibition.


systemO

public ConceptSystem systemO
Source system for mapping.


systemN

public ConceptSystem systemN
Target system for mapping.


nStep

public int nStep
Actual number of steps being recorded during network iteration.


status

public int status
Status of the system.


exSim

public double[][] exSim
External similarity E[row][col].


inSim

public double[][][] inSim
Internal similarity, also called activator, R[step][row][col].


inhib

public double[][][] inhib
Inhibitor I[step][row][col].


netIn

public double[][][] netIn
Network input N[step][row][col].


correspond

public double[][][] correspond
Correspondence matrix C[step][row][col].


mapON

public int[] mapON
Mappings from systemO to systemN, recording indices of matched concepts.


mapNO

public int[] mapNO
Mappings from systemN to systemO, recording indices of matched concepts.


results

public Absurdist.Results results
Constructor Detail

Absurdist

public Absurdist()
Creates an empty absurdist system.


Absurdist

public Absurdist(ConceptSystem systemO,
                 ConceptSystem systemN)
Creates an absurdist system containing the source and target concept systems and random external similarities.

Method Detail

setSystemO

public void setSystemO(ConceptSystem systemO)
Sets the source concepts system to be mapped from.


setSystemN

public void setSystemN(ConceptSystem systemN)
Sets the target concepts system to be mapped to.


setSystems

public void setSystems(ConceptSystem systemO,
                       ConceptSystem systemN)
Sets the two concepts systems for mapping.


initExSim

public void initExSim()
Initialize external similarity matrix to all 0's.


turnOffHistory

public static void turnOffHistory()
Turn off the iteration history recording so that less memory will be used. This is used if you don't need to keep the intermediate results during the iteration. This is important for saving memory, and should always be done when you don't use the GUI and don't need the "timeseries" graphs.


calcLinkSim

public double calcLinkSim(Link lo,
                          Link ln)
Computes the similarity between the two links. Each link may be a "real" link (a pair of numbers), or the EMPTY link.


readjustChi

public void readjustChi(double[][] exSim,
                        double[][] inSim,
                        double[][] inhib)
A normalization method that takes both exSim and inSim into account. The goal is to have sum_{a,b}( (alpha*exSim + beta*inSim - chi*inhib)[a][b]) = 0. Learning rate may be recomputed too.


sumElem

public double sumElem(double[][] a)
Computes the sum of the elements in an array.


evalMap

public void evalMap()
Evaluates the quality of the mapping in mapON[].

Note: mismapped concepts and relations only apply to mappings between a concept system and its noisy copy, assuming that the noise is small enough so that the mapping should be identity, i.e. Ci -> Ci'.


mapSystem

public void mapSystem()
Maps orginal concept system to the one with added noise, using exponenital/linear activator/inhibitor. systemO and systemN have to be set preceding to calling this method.


isInitial

public boolean isInitial()
Returns true if the two systems have not yet been created; otherwise false.


isCreated

public boolean isCreated()
Returns true if the two systems are already created; otherwise false.


isIterating

public boolean isIterating()
Returns true if the network iteration is going on; otherwise false.


isConverged

public boolean isConverged()
Returns true if the network iteration is converged; otherwise false.


isMapped

public boolean isMapped()
Returns true if the two systems are already mapped; otherwise false.


writeCorrespond

public void writeCorrespond(java.lang.String filename)
                     throws java.lang.Exception
Writes the correspondence matrix to a text file.

java.lang.Exception

writeMap

public void writeMap(java.lang.String filename)
              throws java.lang.Exception
Writes the mapping between systemO and systemN to a text file.

java.lang.Exception

printSystems

public void printSystems()
Prints the two systems to the standard output.


printExSim

public void printExSim()
Prints the external similarity matrix to the standard output.


printCorrespond

public void printCorrespond()
Prints the correspondence matrix to the standard output.


printMap

public void printMap()
Prints the mapping between systemO and systemN to the standard output.


print

public void print()
           throws java.lang.Exception
Prints the source and target concept systems, the correspondence matrix, and the final mappings.

java.lang.Exception

loadSystems

public static Absurdist loadSystems(java.lang.String fileName,
                                    int w,
                                    int h)
Creates a new instance of Absurdist initialized with the 2 systems read from a file containing Java serialized objects. Such a file may have been produced with saveSystems(). For display purposes, both graph are to be fitted into a w-by-x panel, splitting it into 2 halves.

Parameters:
w - Width of the display area for the graphs.
h - Height of the display area for the graphs.

saveSystems

public void saveSystems(java.lang.String fileName)
Writes out the concept systems as Java serialized objects intoa file. This method can be used if you want to restore the data later from the file, using loadSystems().