From: <jen...@us...> - 2007-11-12 14:11:23
|
Revision: 280 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=280&view=rev Author: jenslehmann Date: 2007-11-12 06:11:18 -0800 (Mon, 12 Nov 2007) Log Message: ----------- made some more options thread safe Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/Config.java trunk/src/dl-learner/org/dllearner/ConfigurationManager.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java trunk/src/dl-learner/org/dllearner/cli/Start.java Modified: trunk/src/dl-learner/org/dllearner/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/Config.java 2007-11-11 09:41:14 UTC (rev 279) +++ trunk/src/dl-learner/org/dllearner/Config.java 2007-11-12 14:11:18 UTC (rev 280) @@ -112,16 +112,16 @@ public static class Refinement { // Nutzung der Äquivalenz ALL R.C AND ALL R.D = ALL R.(C AND D) - public static boolean applyAllFilter = true; +// 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 applyExistsFilter = true; - public static boolean useTooWeakList = true; +// public static boolean useTooWeakList = true; - public static boolean useOverlyGeneralList = true; +// public static boolean useOverlyGeneralList = true; - public static boolean useShortConceptConstruction = true; +// public static boolean useShortConceptConstruction = true; public static double horizontalExpansionFactor = 0.6; Modified: trunk/src/dl-learner/org/dllearner/ConfigurationManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/ConfigurationManager.java 2007-11-11 09:41:14 UTC (rev 279) +++ trunk/src/dl-learner/org/dllearner/ConfigurationManager.java 2007-11-12 14:11:18 UTC (rev 280) @@ -488,17 +488,17 @@ ; //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")) +// } 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); Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2007-11-11 09:41:14 UTC (rev 279) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2007-11-12 14:11:18 UTC (rev 280) @@ -54,6 +54,11 @@ // these are computed as the result of the previous four settings Set<AtomicConcept> usedConcepts; Set<AtomicRole> usedRoles; + private boolean applyAllFilter = true; + private boolean applyExistsFilter = true; + private boolean useTooWeakList = true; + private boolean useOverlyGeneralList = true; + private boolean useShortConceptConstruction = true; private boolean stop = false; @@ -214,6 +219,16 @@ ignoredConcepts = CommonConfigMappings.getAtomicConceptSet((Set<String>)entry.getValue()); } else if(name.equals("ignoredRoles")) { ignoredRoles = CommonConfigMappings.getAtomicRoleSet((Set<String>)entry.getValue()); + } else if(name.equals("applyAllFilter")) { + applyAllFilter = (Boolean) entry.getValue(); + } else if(name.equals("applyExistsFilter")) { + applyExistsFilter = (Boolean) entry.getValue(); + } else if(name.equals("useTooWeakList")) { + useTooWeakList = (Boolean) entry.getValue(); + } else if(name.equals("useOverlyGeneralList")) { + useOverlyGeneralList = (Boolean) entry.getValue(); + } else if(name.equals("useShortConceptConstruction")) { + useShortConceptConstruction = (Boolean) entry.getValue(); } } @@ -240,7 +255,7 @@ } // this.learningProblem2 = learningProblem2; - operator = new RhoDown(rs); + operator = new RhoDown(rs, applyAllFilter, applyExistsFilter); // candidate sets entsprechend der gewählten Heuristik initialisieren candidates = new TreeSet<Node>(nodeComparator); @@ -574,7 +589,7 @@ boolean propernessDetected = false; // 1. short concept construction - if(Config.Refinement.useShortConceptConstruction) { + if(useShortConceptConstruction) { // kurzes Konzept konstruieren Concept shortConcept = ConceptTransformation.getShortConcept(refinement, conceptComparator); int n = conceptComparator.compare(shortConcept, concept); @@ -587,7 +602,7 @@ } // 2. too weak test - if(!propernessDetected && Config.Refinement.useTooWeakList) { + if(!propernessDetected && useTooWeakList) { if(refinement instanceof MultiConjunction) { boolean tooWeakElement = containsTooWeakElement((MultiConjunction)refinement); if(tooWeakElement) { @@ -695,7 +710,7 @@ int quality = -2; // overly general list verwenden - if(Config.Refinement.useOverlyGeneralList && refinement instanceof MultiDisjunction) { + if(useOverlyGeneralList && refinement instanceof MultiDisjunction) { if(containsOverlyGeneralElement((MultiDisjunction)refinement)) { conceptTestsOverlyGeneralList++; quality = getNumberOfNegatives(); Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java 2007-11-11 09:41:14 UTC (rev 279) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/RhoDown.java 2007-11-12 14:11:18 UTC (rev 280) @@ -88,10 +88,15 @@ public long mComputationTimeNs = 0; public long topComputationTimeNs = 0; + private boolean applyAllFilter = true; + private boolean applyExistsFilter = true; + // braucht man wirklich das learningProblem oder reicht der Reasoning-Service? // TODO: conceptComparator könnte auch noch Parameter sein - public RhoDown(ReasoningService reasoningService) { + public RhoDown(ReasoningService reasoningService, boolean applyAllFilter, boolean applyExistsFilter) { this.rs = reasoningService; + this.applyAllFilter = applyAllFilter; + this.applyExistsFilter = applyExistsFilter; // this.learningProblem = learningProblem; // rs = learningProblem.getReasoningService(); } @@ -318,7 +323,7 @@ // falls Refinement von der Form ALL r ist, dann prüfen, ob // ALL r nicht bereits vorkommt - if(Config.Refinement.applyAllFilter) { + if(applyAllFilter) { if(c instanceof All) { for(Concept child : concept.getChildren()) { if(child instanceof All) { @@ -444,7 +449,7 @@ ConceptTransformation.transformToOrderedNegationNormalForm(concept, conceptComparator); } - if(Config.Refinement.applyExistsFilter) { + if(applyExistsFilter) { Iterator<MultiDisjunction> it = baseSet.iterator(); while(it.hasNext()) { MultiDisjunction md = it.next(); Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2007-11-11 09:41:14 UTC (rev 279) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2007-11-12 14:11:18 UTC (rev 280) @@ -120,6 +120,7 @@ sources.add(ks); configureComponent(cm, ks, componentPrefixMapping, parser); + initComponent(cm, ks); } // step 2: detect used reasoner @@ -134,6 +135,7 @@ } ReasonerComponent reasoner = cm.reasoner(reasonerClass, sources); configureComponent(cm, reasoner, componentPrefixMapping, parser); + initComponent(cm, reasoner); ReasoningService rs = cm.reasoningService(reasoner); // step 3: detect learning problem @@ -155,7 +157,8 @@ cm.applyConfigEntry(lp, "positiveExamples", posExamples); if(lpClass != PosOnlyDefinitionLP.class) cm.applyConfigEntry(lp, "negativeExamples", negExamples); - + initComponent(cm, lp); + // step 4: detect learning algorithm ConfFileOption algorithmOption = parser.getConfOptionsByName("algorithm"); LearningAlgorithm la = null; @@ -165,13 +168,14 @@ la = cm.learningAlgorithm(laClass, lp, rs); configureComponent(cm, la, componentPrefixMapping, parser); - + initComponent(cm, la); + // initialise all structures - for (KnowledgeSource source : sources) - initComponent(cm, source); - initComponent(cm, reasoner); - initComponent(cm, lp); - initComponent(cm, la); +// for (KnowledgeSource source : sources) +// initComponent(cm, source); +// initComponent(cm, reasoner); +// initComponent(cm, lp); +// initComponent(cm, la); // perform file exports performExports(parser, baseDir, sources, rs); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |