From: <jen...@us...> - 2007-11-12 15:19:31
|
Revision: 283 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=283&view=rev Author: jenslehmann Date: 2007-11-12 07:19:23 -0800 (Mon, 12 Nov 2007) Log Message: ----------- removed deprecated classes Config and ConfigurationManager (finally) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/Config.java trunk/src/dl-learner/org/dllearner/ConfigurationManager.java Deleted: trunk/src/dl-learner/org/dllearner/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/Config.java 2007-11-12 15:13:50 UTC (rev 282) +++ trunk/src/dl-learner/org/dllearner/Config.java 2007-11-12 15:19:23 UTC (rev 283) @@ -1,261 +0,0 @@ -package org.dllearner; - -import java.lang.reflect.Field; - -public class Config { - // standardmäßig wird bis Tiefe 7 gesucht - // public static int maxLength = 7; - - // public static int maxDepth; - - // Punktabzug für "ungenaue" Klassifizierungen, also positiv als neutral, - // neutral als negativ und negativ als neutral - // public static double accuracyPenalty = 1; - - // Punktabzug für fehlerhafte Klassifizierungen, also positiv als negativ - // und negativ als positiv - // public static double errorPenalty = 3; - - // public static ScoreMethod scoreMethod = ScoreMethod.POSITIVE; - - // public static LearningProblemType learningProblemType = LearningProblemType.TWO_VALUED; - - // public static boolean penalizeNeutralExamples = false; - - // public static boolean showCorrectClassifications = false; - - // wieviel Prozent darf ein um eine Einheit längeres Konzept schlechter - // sein (aktuell: 5% sind eine Verlängerung um 1 wert) - // Problem: dieser Parameter hat für GP und Refinement zwar die gleiche - // Bedeutung, - // aber es sind unterschiedliche Werte angebracht; - // bei GP sollte der Wert so sein, dass am Ende das gewünschte Konzept - // tatsächlich die beste Fitness hat, also eher niedrig (<0.005); - // bei Refinement in flexible heuristic soll es so sein, dass schlechtere - // Konzepte - // probiert werden sollen, sobald horizontal expansion eines gut - // klassifizierenden - // Knotens steigt => da ist also gewünscht das kürzere aber schlechtere - // Knoten - // ev. einen Vorsprung haben => demzufolge ist dort ein hoher Wert (ca. - // 0.05) - // angebracht - // public static double percentPerLengthUnit = 0.0025; - // public static double percentPerLengthUnit = 0.05; - -// public enum Algorithm { -// GP, BRUTE_FORCE, RANDOM_GUESSER, REFINEMENT, HYBRID_GP -// }; -// -// public static Algorithm algorithm = Algorithm.REFINEMENT; - - // Rückgabetyp des gelernten Konzepts - // public static String returnType = ""; - - // public static boolean statisticMode = false; - - // if set to true a retrieval algorithm is used for classification - // instead of single instance checks (default is now false, because - // we can send all instance checks in a single request), for KAON2 - // as reasoner it should in many cases be set to true - // public static boolean useRetrievalForClassification = false; - - // welche Art von Reasoning wird benutzt (eigener Algorithmus, - // KAON2-API, DIG-Interface) - // public static ReasonerType reasonerType = ReasonerType.DIG; - - // bei fast retrieval muss trotzdem irgendein Reasoner gesetzt - // werden um die flat ABox zu erzeugen - // public static ReasonerType startUpReasoningType = ReasonerType.KAON2; - - // public static URL digReasonerURL = null; - - // unique names assumption - // public static boolean una = false; - - // open world assumption; momentan wird closed world assumption nur - // fuer Rollen unterstuetzt - // public static boolean owa = true; - - // an-/abschalten von System.nanoTime()-Aufrufen außerhalb des - // Reasoningservice - // public static boolean useNonReasonerBenchmarks = false; - - // erlaubt das abschalten von Benchmarks bei der Subsumptionhierarchie, - // da diese ohnehin gecacht wird, also die System.nanoTime()-Aufrufe nur - // Zeit kosten - // public static boolean useHierarchyReasonerBenchmarks = false; - - // public static List<String> hidePrefixes = new LinkedList<String>(); - - // Informationen (Rollen, Konzepte, Individuen, Anzahl Axiome) über - // Wissensbasis anzeigen => alles konfigurierbar um Output in Grenzen - // zu halten -// public static boolean showRoles = false; -// public static boolean showConcepts = false; -// public static boolean showIndividuals = false; -// public static boolean showSubsumptionHierarchy = false; - // zeigt die interne Wissensbasis an (d.h. keine externen OWL-Dateien) -// public static boolean showInternalKB = false; -// public static int maxLineLength = 100; - - // public static boolean writeDIGProtocol = false; - // public static File digProtocolFile = new File("log/digProtocol.txt"); - - // public static String preprocessingModule = ""; - - // TODO: noch nicht implementiert, dass man diese per Config-Datei setzen - // kann - public static class Refinement { - - // Nutzung der Äquivalenz ALL R.C AND ALL R.D = ALL R.(C AND D) -// public static boolean applyAllFilter = true; - - // Nutzung der Äquivalenz EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D) -// public static boolean applyExistsFilter = true; - -// public static boolean useTooWeakList = true; - -// public static boolean useOverlyGeneralList = true; - -// public static boolean useShortConceptConstruction = true; - -// public static double horizontalExpansionFactor = 0.6; - -// public static boolean improveSubsumptionHierarchy = true; - -// public static boolean quiet = false; - - // public static boolean writeSearchTree = false; - - // public static File searchTreeFile = new File("searchTree.txt"); - - // public static Heuristic heuristic = Heuristic.LEXICOGRAPHIC; - - // multi instance check => es wird versucht mehrere instance checks pro - // Anfrage auf einmal an den Reasoner zu schicken; Vorteil bei DIG: - // weniger Kommunikation; Nachteil: es müssen alle instanceChecks - // ausgeführt - // werden, bevor too weak festgestellt werden kann - // TODO: not implemented -// public static UseMultiInstanceChecks useDIGMultiInstanceChecks = UseMultiInstanceChecks.TWOCHECKS; - - // geplante Optionen um den Suchraum einzuschränken - - // Konzepte, die in der Definition vorkommen können (per Default - // ("null") alle) - // nicht implementiert -// public static Set<AtomicConcept> allowedConcepts = null; - // ignorierte Konzepte; Default null = keine -// public static Set<AtomicConcept> ignoredConcepts = null; - // beachte: es können nur entweder die erlaubten oder die ignorierten - // Konzepte - // gesetzt werden - - // true falls die Konzepte vom Nutzer gesetzt worden (also - // allowedConcepts - // gleich null), ansonsten false -// public static boolean allowedConceptsAutoDetect = true; - - // Rollen, die in der Lösung vorkommen können - // nicht implementiert -// public static Set<AtomicRole> allowedRoles = null; -// public static Set<AtomicRole> ignoredRoles = null; -// public static boolean allowedRolesAutoDetect = true; - - // max. Verschachtelungstiefe der Lösung - // nicht implementiert -// public static int maxDepth = 0; - - // Konstruktoren an- und abschalten - // nicht implementiert -// public static boolean useAllConstructor = true; -// public static boolean useExistsConstructor = true; -// public static boolean useNegation = true; - // public static boolean useDisjunction = true; - // public static boolean useConjunction = true; - - // Domain und Range beim Verschachteln von Rollen beachten - // nicht implementiert - // TODO: Wie soll man das in DIG machen? -// public static boolean useDomainRange = false; - - // bereits vorher allgemeinere Konzepte festlegen (Default: keine) - // nicht implementiert - // => ist eigentlich unnötig, da dieses Wissen zur Ontologie hinzugefügt - // und dann gelernt werden kann - // public static List<AtomicConcept> fixedUpperConcepts; - - } - - public static class GP { - - // FPS funktioniert momentan noch nicht, es muss sichergestellt werden, - // dass die Fitness positiv ist (momentan ist sie nie gr��er 0) -// public static SelectionType selectionType = SelectionType.RANK_SELECTION; -// -// public static int tournamentSize = 3; -// -// public static boolean elitism = true; -// -// public static AlgorithmType algorithmType = AlgorithmType.STEADY_STATE; -// -// public static double mutationProbability = 0.03d; -// -// public static double crossoverProbability = 0.95d; -// -// public static double hillClimbingProbability = 0.0d; -// -// public static double refinementProbability = 0.0; -// -// public static int numberOfIndividuals = 100; -// -// public static int numberOfSelectedIndividuals = 96; -// -// public static boolean useFixedNumberOfGenerations = false; -// -// public static int generations = 20; -// -// public static int postConvergenceGenerations = 50; -// -// public static boolean adc = false; -// -// public static int initMinDepth = 4; -// -// public static int initMaxDepth = 6; -// -// public static int maxConceptLength = 75; -// -// // bei true werden statt Disjunction MultiDisjunction und statt -// // Conjunction -// // MultiConjunction im GP benutzt (es gibt derzeit keinen Grund es auf -// // false -// // zu setzen) -// public static boolean useMultiStructures = true; - - } - - public static String print() { - StringBuffer buff = new StringBuffer(); - buff.append("** overview of all set config values**\n\n"); - - Field[] fields = Config.class.getDeclaredFields(); - // Field[] fields = this.getClass().getDeclaredFields(); - for (int i = 0; i < fields.length; i++) { - try { - buff.append(fields[i].getName()).append("\t=>\t").append(fields[i].get(Config.class)) - .append("\n"); - - // System.out.println(fields[i].getName() + " : values: " + - // fields[i].get(this)); - } catch (IllegalAccessException ex) { - ex.printStackTrace(System.out); - } catch (IllegalArgumentException ex) { - ex.printStackTrace(System.out); - } - - } - return buff.toString(); - - } -} Deleted: trunk/src/dl-learner/org/dllearner/ConfigurationManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/ConfigurationManager.java 2007-11-12 15:13:50 UTC (rev 282) +++ trunk/src/dl-learner/org/dllearner/ConfigurationManager.java 2007-11-12 15:19:23 UTC (rev 283) @@ -1,574 +0,0 @@ -package org.dllearner; - -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.dllearner.cli.ConfFileOption; - -/** - * Nach dem einlesen der Datei werden hier alle Konfigurationsoptionen - * abgespeichert. Diese werden hier erst verwaltet und dann - * angewandt, indem die Werte der Variablen in Config umgeschrieben - * werden (bzw. es werden Fehlermeldungen bei nicht existierenden, - * inkorrekten oder inkompatiblen Einstellungen ausgegeben). - * - * TODO: Eventuell kann man damit Config.java ersetzen? Das w�re etwas - * sauberer, wenn man den DL-Learner als API sieht, der z.B. von - * OntoWiki aus genutzt wird. Dann k�nnte man sicherstellen, dass - * Konfigurationsoptionen nicht direkt ge�ndert werden, sondern - * �ber Anmeldung von �nderungen beim Konfigurationsmanager. - * - * TODO: noch checken, ob man die �berpr�fung der G�ltigkeit von - * Konfigurationsoptionen nicht schon bei deren Erstellung machen sollte - * - * @author jl - * - */ -public class ConfigurationManager { - - private Collection<ConfFileOption> options; - - // verfuegbare Optionen - // Problemfall: double-Optionen, die auch int-Optionen sein können; - // diese sind in beiden Mengen vertreten => man kann vereinbaren, dass - // jede double-Option auch eine int-Option sein kann - private Map<String, Integer[]> intOptions; - private Map<String, Double[]> doubleOptions; - private Map<String, String[]> strOptions; - private List<String> setOptions; - - public ConfigurationManager() { - this(new LinkedList<ConfFileOption>()); - } - - public ConfigurationManager(Collection<ConfFileOption> confOptions) { - // options = new HashSet<ConfigurationOption>(); - options = confOptions; - strOptions = new HashMap<String, String[]>(); - intOptions = new HashMap<String, Integer[]>(); - doubleOptions = new HashMap<String, Double[]>(); - setOptions = new LinkedList<String>(); - createIntOptions(); - createDoubleOptions(); - createStringOptions(); - createSetOptions(); - } - - public void applyOptions() { - for(ConfFileOption option : options) { - // System.out.println(option); - applyConfigurationOption(option); - } - - // DIG-Reasoner-URL setzen, falls nicht schon geschehen (kann wegen Exception - // nicht in Config gesetzt werden) -// if(Config.digReasonerURL == null) { -// try { -// Config.digReasonerURL = new URL("http://localhost:8081"); -// } catch (MalformedURLException e) { -// // Exception tritt nie auf, da URL korrekt -// e.printStackTrace(); -// } -// } - - // der parserinterne Namespace wird immer ausgeblendet - ; // Config.hidePrefixes.add(KBParser.internalNamespace); - - } - - // ueberprueft, ob es Konflikte zwischen derzeit gesetzten Konfigurationsoptionen gibt - public boolean checkConsistency() { - return true; - } - - // TODO: bei Fehlerbehandlungen müsste man jetzt noch berücksichtigen, dass - // Mengen als 4. Optionstyp (neben int, double, string) dazugekommen sind - public void applyConfigurationOption(ConfFileOption option) { - String optionString; - if(option.containsSubOption()) - optionString = option.getOption() + "." + option.getSubOption(); - else - optionString = option.getOption(); - - if(option.isNumeric()) { - - boolean isInIntOptions = intOptions.containsKey(optionString); - boolean isInDoubleOptions = doubleOptions.containsKey(optionString); - - // numerische Option existiert - if(isInIntOptions || isInDoubleOptions) { - - // es ist eine Option, die nur int-Werte haben darf - if(isInIntOptions) { - if(!option.isIntegerOption()) - throw new Error("The argument of configuration option \"" - + optionString + "\" has to be an integer."); - - // ueberpruefen, ob Wert innerhalb der vorgegebenen Schranken liegt - int minValue = intOptions.get(optionString)[0]; - int maxValue = intOptions.get(optionString)[1]; - if (option.getIntValue() < minValue || option.getIntValue() > maxValue) { - System.out.println("Error: The argument of configuration option \"" - + optionString + "\" is out of range. It has to be between " - + minValue + " and " + maxValue + "."); - System.exit(0); - } - - // alles OK, Option kann angewandt werden - applyIntOptions(optionString,option.getIntValue()); - // es ist eine Option, die int- oder double-Werte haben darf - } else { - // ueberpruefen, ob Wert innerhalb der vorgegebenen Schranken liegt - double minValue = doubleOptions.get(optionString)[0]; - double maxValue = doubleOptions.get(optionString)[1]; - - // Wert der Option bestimmen - double val; - if(option.isIntegerOption()) - val = option.getIntValue(); - else - val = option.getDoubleValue(); - - if (val < minValue || val > maxValue) { - System.out.println("Error: The argument of configuration option \"" - + optionString + "\" is out of range. It has to be between " - + minValue + " and " + maxValue + "."); - System.exit(0); - } - - // alles OK, Option kann angewandt werden - applyDoubleOptions(optionString,val); - } - - // numerische Option existiert nicht => Fehlerbehandlung - } else { - if(strOptions.containsKey(optionString)) - throw new RuntimeException("The argument of configuration option \"" - + optionString + "\" has to be a string."); - else - throw new RuntimeException("Configuration option \"" - + optionString + "\" does not exist."); - } - } else if (option.isSetOption()) { - if(setOptions.contains(optionString)) { - applySetOptions(optionString,option.getSetValues()); - } else { - throw new Error("Configuration option \"" - + optionString + "\" does not exist or its argument is not a list."); - } - - } else { - // Option existiert - if(strOptions.containsKey(optionString)) { - // ueberpruefen, ob Optionswert numerisch ist - if(option.isIntegerOption()) - throw new Error("The argument of configuration option \"" - + optionString + "\" has to be a string."); - - // moegliche Werte pruefen (wenn keine moeglichen Werte angegeben sind, dann sind - // alle Strings erlaubt) - String[] possibleValuesArray = strOptions.get(optionString); - List<String> possibleValues = Arrays.asList(possibleValuesArray); - if (!possibleValues.contains(option.getStringValue()) && possibleValues.size() != 0) { - System.out.println("Error: The configuration option \"" + optionString - + "\" must not have value \"" + option.getStringValue() - + "\". The value must be one of " + possibleValues + "."); - System.exit(0); - } - - // alles OK, Option kann angewandt werden - applyStringOptions(optionString,option.getStringValue()); - - // Option existiert nicht => Fehlerbehandlung - } else { - if(intOptions.containsKey(optionString)) - throw new Error("The argument of configuration option \"" - + optionString + "\" has to be a number."); - else - throw new Error("Configuration option \"" - + optionString + "\" does not exist."); - } - } - // options.add(option); - } - - // Code aus Main zur Behandlung von Optionen - /* - if (node instanceof ASTConfOption) { - // allgemeine Variablenzuweisungen, damit die Implementierung - // f�r jede einzelne Option dann einfach wird - String option = ((ASTId) node.jjtGetChild(0)).getId(); - String optionIndex = option; - // etwas vorsichtig sein, da Werte initialisiert werden, auch - // wenn es z.B. keinen Integer in der Option gibt - String subOption = ""; - boolean valueIsInt = false; - int intValue = 0; - String strValue = ""; - // zwei Optionen mit Punkt getrennt - if (node.jjtGetNumChildren() == 3) { - subOption = ((ASTId) node.jjtGetChild(1)).getId(); - optionIndex += "." + subOption; - if (node.jjtGetChild(2) instanceof ASTNumber) { - intValue = ((ASTNumber) node.jjtGetChild(2)).getId(); - valueIsInt = true; - } else - strValue = ((ASTId) node.jjtGetChild(2)).getId(); - // eine Option - } else { - if (node.jjtGetChild(1) instanceof ASTNumber) { - intValue = ((ASTNumber) node.jjtGetChild(1)).getId(); - valueIsInt = true; - } else - strValue = ((ASTId) node.jjtGetChild(1)).getId(); - } - - if (intOptions.containsKey(optionIndex)) { - if (!valueIsInt) { - System.out.println("Error: The argument of configuration option \"" - + optionIndex + "\" has to be a number."); - System.exit(0); - } - int minValue = intOptions.get(optionIndex)[0]; - int maxValue = intOptions.get(optionIndex)[1]; - if (intValue < minValue || intValue > maxValue) { - System.out.println("Error: The argument of configuration option \"" - + optionIndex + "\" is out of range. It has to be between " - + minValue + " and " + maxValue + "."); - System.exit(0); - } - - applyIntOptions(optionIndex, intValue); - - } else if (strOptions.containsKey(optionIndex)) { - if (valueIsInt) { - System.out.println("The argument of configuration option \"" + optionIndex - + "\" must not be a number."); - System.exit(0); - } - - String[] possibleValuesArray = strOptions.get(optionIndex); - List<String> possibleValues = Arrays.asList(possibleValuesArray); - if (!possibleValues.contains(strValue) && possibleValues.size() != 0) { - System.out.println("Error: The configuration option \"" + optionIndex - + "\" must not have value \"" + strValue - + "\". The value must be one of " + possibleValues + "."); - System.exit(0); - } - - applyStringOptions(optionIndex, strValue); - - } else { - System.out.println("Error: " + optionIndex - + " is not a valid configuration option"); - System.exit(0); - } - - } - - */ - - - - //private Map<String, Integer[]> createIntOptions() { - // Map<String, Integer[]> intOptions = new HashMap<String, Integer[]>(); - private void createIntOptions() { - - intOptions.put("maxLength", new Integer[] { 1, 20 }); - // intOptions.put("accuracyPenalty", new Integer[] { 1, 1000 }); - // intOptions.put("errorPenalty", new Integer[] { 1, 1000 }); - intOptions.put("gp.numberOfIndividuals", new Integer[] { 10, 1000000 }); - intOptions.put("gp.numberOfSelectedIndividuals", new Integer[] { 10, 1000000 }); - // intOptions.put("gp.crossoverPercent", new Integer[] { 0, 100 }); - // intOptions.put("gp.mutationPercent", new Integer[] { 0, 100 }); - // intOptions.put("gp.hillClimbingPercent", new Integer[] { 0, 100 }); - intOptions.put("gp.postConvergenceGenerations", new Integer[] { 10, 1000 }); - intOptions.put("gp.generations", new Integer[] { 10, 1000 }); - intOptions.put("gp.tournamentSize", new Integer[] { 1, 10 }); - intOptions.put("gp.initMinDepth", new Integer[] { 1, 10 }); - intOptions.put("gp.initMaxDepth", new Integer[] { 1, 20 }); - - // return intOptions; - } - - private void createDoubleOptions() { - - // double-Optionen, die auch int sein können - doubleOptions.put("accuracyPenalty", new Double[] { 1d, 1000d }); - doubleOptions.put("errorPenalty", new Double[] { 1d, 1000d }); - doubleOptions.put("gp.crossoverPercent", new Double[] { 0d, 100d }); - doubleOptions.put("gp.mutationPercent", new Double[] { 0d, 100d }); - doubleOptions.put("gp.hillClimbingPercent", new Double[] { 0d, 100d }); - doubleOptions.put("gp.refinementPercent", new Double[] { 0d, 100d }); - doubleOptions.put("refinement.horizontalExpansionFactor", new Double[] { 0d, 1d }); - doubleOptions.put("percentPerLengthUnit", new Double[] { 0d, 1d }); - - } - - //private Map<String, String[]> createStringOptions() { - // Map<String, String[]> strOptions = new HashMap<String, String[]>(); - private void createStringOptions() { - final String[] booleanArray = new String[] { "true", "false" }; - // leerer Array = keine Einschraenkung - - strOptions.put("penalizeNeutralExamples", booleanArray); - strOptions.put("scoreMethod", new String[] { "full", "positive" }); - strOptions.put("showCorrectClassifications", booleanArray); - // etwas eleganter waere hier, wenn man erst die Wissensbasis und dann - // die Optionen parst, dann koennte man implementieren, dass der Rueckgabetyp - // einem Konzeptname entsprechen muss - strOptions.put("returnType", new String[] {}); - strOptions.put("statMode", booleanArray); - strOptions.put("una", booleanArray); - strOptions.put("owa", booleanArray); - strOptions.put("algorithm", new String[] { "gp", "bruteForce", "random", "refinement", "hybridGP" }); - strOptions.put("reasoner", new String[] { "dig", "kaon2", "fastRetrieval" }); - strOptions.put("digReasonerURL", new String[] {}); - strOptions.put("useRetrievalForClassification", booleanArray); - strOptions.put("hidePrefix", new String[] {}); - strOptions.put("showIndividuals", booleanArray); - strOptions.put("showConcepts", booleanArray); - strOptions.put("showRoles", booleanArray); - strOptions.put("showInternalKB", booleanArray); - strOptions.put("showSubsumptionHierarchy", booleanArray); - strOptions.put("writeDIGProtocol", booleanArray); - strOptions.put("digProtocolFile", new String[] {}); - // strOptions.put("preprocessingModule", new String[] {}); - strOptions.put("gp.selectionType", new String[] { "rankSelection", "fps", "tournament" }); - strOptions.put("gp.elitism", booleanArray); - strOptions.put("gp.algorithmType", new String[] { "steadyState", "generational" }); - strOptions.put("gp.adc", booleanArray); - strOptions.put("gp.useFixedNumberOfGenerations", booleanArray); - strOptions.put("refinement.heuristic", new String[] { "lexicographic", "flexible" }); - strOptions.put("refinement.quiet", booleanArray); - strOptions.put("refinement.writeSearchTree", new String[] {}); - strOptions.put("refinement.searchTreeFile", new String[] {}); - strOptions.put("refinement.applyAllFilter", booleanArray); - strOptions.put("refinement.applyExistsFilter", booleanArray); - strOptions.put("refinement.useTooWeakList", booleanArray); - strOptions.put("refinement.useOverlyGeneralList", booleanArray); - strOptions.put("refinement.useShortConceptConstruction", booleanArray); - strOptions.put("refinement.useDIGMultiInstanceChecks", new String[] { "never", "twoChecks", "oneCheck"}); - strOptions.put("refinement.useAllConstructor", booleanArray); - strOptions.put("refinement.useExistsConstructor", booleanArray); - strOptions.put("refinement.useNegation", booleanArray); - } - - private void createSetOptions() { - setOptions.add("refinement.allowedConcepts"); - setOptions.add("refinement.allowedRoles"); - setOptions.add("refinement.ignoredConcepts"); - setOptions.add("refinement.ignoredRoles"); - } - - private void applyIntOptions(String option, int value) { - if (option.equals("maxLength")) - ;//Config.maxLength = value; -// else if (option.equals("gp.numberOfIndividuals")) -// Config.GP.numberOfIndividuals = value; -// else if (option.equals("gp.numberOfSelectedIndividuals")) -// Config.GP.numberOfSelectedIndividuals = value; -// else if (option.equals("gp.postConvergenceGenerations")) -// Config.GP.postConvergenceGenerations = value; -// else if (option.equals("gp.generations")) -// Config.GP.generations = value; -// else if (option.equals("gp.tournamentSize")) -// Config.GP.tournamentSize = value; -// else if (option.equals("gp.initMinDepth")) -// Config.GP.initMinDepth = value; -// else if (option.equals("gp.initMaxDepth")) -// Config.GP.initMaxDepth = value; - } - - private void applyDoubleOptions(String option, double value) { - // System.out.println(option + " " + value); - if (option.equals("accuracyPenalty")) - ; //Config.accuracyPenalty = value; - else if (option.equals("errorPenalty")) - ; //Config.errorPenalty = value; -// else if (option.equals("gp.crossoverPercent")) -// Config.GP.crossoverProbability = value / (double) 100; -// else if (option.equals("gp.mutationPercent")) -// Config.GP.mutationProbability = value / (double) 100; -// else if (option.equals("gp.hillClimbingPercent")) -// Config.GP.hillClimbingProbability = value / (double) 100; -// else if (option.equals("gp.refinementPercent")) -// Config.GP.refinementProbability = value / (double) 100; -// else if (option.equals("refinement.horizontalExpansionFactor")) -// Config.Refinement.horizontalExpansionFactor = value; - else if (option.equals("percentPerLengthUnit")) - ; // Config.percentPerLengthUnit = value; - } - - private void applyStringOptions(String option, String value) { - if (option.equals("penalizeNeutralExamples")) - ; // Config.penalizeNeutralExamples = Datastructures.strToBool(value); - else if (option.equals("showCorrectClassifications")) - ; // Config.showCorrectClassifications = Datastructures.strToBool(value); - else if (option.equals("statMode")) - ; // Config.statisticMode = Datastructures.strToBool(value); - else if (option.equals("una")) - ; // Config.una = Datastructures.strToBool(value); - else if (option.equals("owa")) - ; // Config.owa = Datastructures.strToBool(value); -// else if (option.equals("gp.useFixedNumberOfGenerations")) -// Config.GP.useFixedNumberOfGenerations = Datastructures.strToBool(value); -// else if (option.equals("scoreMethod")) { -// if (value.equals("full")) -// Config.scoreMethod = ScoreMethod.FULL; -// else -// Config.scoreMethod = ScoreMethod.POSITIVE; -// } else if (option.equals("returnType")) -// Config.returnType = value; -// else if (option.equals("algorithm")) { -// if (value.equals("gp")) -// Config.algorithm = Algorithm.GP; -// else if (value.equals("random")) -// Config.algorithm = Algorithm.RANDOM_GUESSER; -// else if(value.equals("bruteForce")) -// Config.algorithm = Algorithm.BRUTE_FORCE; -// else if(value.equals("refinement")) -// Config.algorithm = Algorithm.REFINEMENT; -// // hybrid GP = Menge von Konfigurationsoptionen -// else { -// Config.algorithm = Algorithm.HYBRID_GP; -// Config.GP.refinementProbability = 1.0d; -// Config.GP.crossoverProbability = 0.0d; -// Config.GP.hillClimbingProbability = 0.0d; -// Config.GP.mutationProbability = 0.0d; -// } - else if(option.equals("hidePrefix")) { -// Config.hidePrefixes.add(value); - } else if (option.equals("showIndividuals")) { -// Config.showIndividuals = Datastructures.strToBool(value); - } else if (option.equals("showConcepts")) { -// Config.showConcepts = Datastructures.strToBool(value); - } else if (option.equals("showRoles")) { -// Config.showRoles = Datastructures.strToBool(value); - } else if (option.equals("showInternalKB")) { -// Config.showInternalKB = Datastructures.strToBool(value); - } else if (option.equals("showSubsumptionHierarchy")) { -// Config.showSubsumptionHierarchy = Datastructures.strToBool(value); - } else if (option.equals("writeDIGProtocol")) { - // Config.writeDIGProtocol = Datastructures.strToBool(value); - } else if (option.equals("digProtocolFile")) { - // Config.digProtocolFile = new File(value); - // } else if (option.equals("preprocessingModule")) { -// // Config.preprocessingModule = value; -// } else if (option.equals("gp.selectionType")) { -// if (value.equals("fps")) -// Config.GP.selectionType = SelectionType.FPS; -// else if (value.equals("rankSelection")) -// Config.GP.selectionType = SelectionType.RANK_SELECTION; -// else -// Config.GP.selectionType = SelectionType.TOURNAMENT_SELECTION; -// } else if (option.equals("gp.algorithmType")) { -// if (value.equals("steadyState")) -// Config.GP.algorithmType = AlgorithmType.STEADY_STATE; -// else -// Config.GP.algorithmType = AlgorithmType.GENERATIONAL; -// } else if (option.equals("gp.adc")) { -//// Config.GP.adc = Datastructures.strToBool(value); - } else if (option.equals("refinement.heuristic")) { -// if(value.equals("lexicographic")) -// Config.Refinement.heuristic = Config.Refinement.Heuristic.LEXICOGRAPHIC; -// else -// Config.Refinement.heuristic = Config.Refinement.Heuristic.FLEXIBLE; - } else if (option.equals("refinement.quiet")) { -// Config.Refinement.quiet = Datastructures.strToBool(value); - } else if (option.equals("refinement.writeSearchTree")) - ; //Config.Refinement.writeSearchTree = Datastructures.strToBool(value); - else if (option.equals("refinement.searchTreeFile")) { - ; // Config.Refinement.searchTreeFile = new File(value); -// } else if (option.equals("refinement.applyAllFilter")) -// Config.Refinement.applyAllFilter = Datastructures.strToBool(value); - } else if (option.equals("refinement.applyExistsFilter")) { -// Config.Refinement.applyExistsFilter = Datastructures.strToBool(value); -// } else if (option.equals("refinement.useTooWeakList")) -// Config.Refinement.useTooWeakList = Datastructures.strToBool(value); -// else if (option.equals("refinement.useOverlyGeneralList")) -// Config.Refinement.useOverlyGeneralList = Datastructures.strToBool(value); -// else if (option.equals("refinement.useShortConceptConstruction")) -// Config.Refinement.useShortConceptConstruction = Datastructures.strToBool(value); -// } else if (option.equals("refinement.useAllConstructor")) -// Config.Refinement.useAllConstructor = Datastructures.strToBool(value); -// else if (option.equals("refinement.useExistsConstructor")) -// Config.Refinement.useExistsConstructor = Datastructures.strToBool(value); -// else if (option.equals("refinement.useNegation")) -// Config.Refinement.useNegation = Datastructures.strToBool(value); -// else if (option.equals("reasoner")) { -// if(value.equals("dig")) -// Config.reasonerType = ReasonerType.DIG; -// else if(value.equals("kaon2")) -// Config.reasonerType = ReasonerType.KAON2; -// else if(value.equals("fastRetrieval")) -// Config.reasonerType = ReasonerType.FAST_RETRIEVAL; -// else if (option.equals("digReasonerURL")) { -// try { -// Config.digReasonerURL = new URL(value); -// } catch (MalformedURLException e) { -// e.printStackTrace(); -// System.err.println("Malformed URL for DIG reasoner was given."); -// System.exit(0); -// } - } -// } else if (option.equals("useRetrievalForClassification")) -// Config.useRetrievalForClassification = Datastructures.strToBool(value); -// else if (option.equals("refinement.useDIGMultiInstanceChecks")) { -// if(value.equals("never")) -// Config.Refinement.useDIGMultiInstanceChecks = Config.Refinement.UseDIGMultiInstanceChecks.NEVER; -// else if(value.equals("twoChecks")) -// Config.Refinement.useDIGMultiInstanceChecks = Config.Refinement.UseDIGMultiInstanceChecks.TWOCHECKS; -// else if(value.equals("oneCheck")) -// Config.Refinement.useDIGMultiInstanceChecks = Config.Refinement.UseDIGMultiInstanceChecks.ONECHECK; -// } - } - - private void applySetOptions(String optionString, Set<String> setValues) { - // System.out.println(":" + optionString + " " + setValues); - - if(optionString.equals("refinement.allowedConcepts")) { -// Config.Refinement.allowedConceptsAutoDetect = false; - ; // Config.Refinement.allowedConcepts = new TreeSet<AtomicConcept>(new ConceptComparator()); -// for(String s : setValues) - // es wird die gleiche Funktion wie im Parser genommen um Namen auf URIs zu mappen -// Config.Refinement.allowedConcepts.add(new AtomicConcept(KBParser.getInternalURI(s))); - } else if(optionString.equals("refinement.allowedRoles")) { -// Config.Refinement.allowedRolesAutoDetect = false; -// Config.Refinement.allowedRoles = new TreeSet<AtomicRole>(new RoleComparator()); -// for(String s : setValues) -// Config.Refinement.allowedRoles.add(new AtomicRole(KBParser.getInternalURI(s))); - } else if(optionString.equals("refinement.ignoredConcepts")) { -// Config.Refinement.ignoredConcepts = new TreeSet<AtomicConcept>(new ConceptComparator()); -// for(String s : setValues) -// Config.Refinement.ignoredConcepts.add(new AtomicConcept(KBParser.getInternalURI(s))); - } else if(optionString.equals("refinement.ignoredRoles")) { -// Config.Refinement.ignoredRoles = new TreeSet<AtomicRole>(new RoleComparator()); -// for(String s : setValues) -// Config.Refinement.ignoredRoles.add(new AtomicRole(KBParser.getInternalURI(s))); - } - } - - public void addDoubleOption(String option, Double[] range) { - doubleOptions.put(option, range); - } - - public Integer[] addIntegerOption(String option, Integer[] value) { - return intOptions.put(option, value); - } - - public boolean addSetOption(String option) { - return setOptions.add(option); - } - - public String[] addStringOption(String option, String[] value) { - return strOptions.put(option, value); - } - -} - Modified: trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java 2007-11-12 15:13:50 UTC (rev 282) +++ trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java 2007-11-12 15:19:23 UTC (rev 283) @@ -27,7 +27,6 @@ import java.util.Map; import java.util.SortedSet; -import org.dllearner.ConfigurationManager; import org.dllearner.algorithms.gp.GP; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; @@ -145,8 +144,8 @@ ComponentManager cm = ComponentManager.getInstance(); // just set default options - ConfigurationManager confMgr = new ConfigurationManager(); - confMgr.applyOptions(); +// ConfigurationManager confMgr = new ConfigurationManager(); +// confMgr.applyOptions(); for(int exampleNr=startExampleNr; exampleNr < examples.length; exampleNr++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |