001    /**
002     * Copyright (C) 2007-2011, Jens Lehmann
003     *
004     * This file is part of DL-Learner.
005     *
006     * DL-Learner is free software; you can redistribute it and/or modify
007     * it under the terms of the GNU General Public License as published by
008     * the Free Software Foundation; either version 3 of the License, or
009     * (at your option) any later version.
010     *
011     * DL-Learner is distributed in the hope that it will be useful,
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014     * GNU General Public License for more details.
015     *
016     * You should have received a copy of the GNU General Public License
017     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
018     */
019    
020    package org.dllearner.utilities.learn;
021    
022    import java.util.SortedSet;
023    import java.util.TreeSet;
024    
025    import org.dllearner.core.ComponentManager;
026    import org.dllearner.core.AbstractKnowledgeSource;
027    import org.dllearner.core.AbstractCELA;
028    import org.dllearner.core.AbstractLearningProblem;
029    import org.dllearner.core.AbstractReasonerComponent;
030    
031    public class LearnConfiguration {
032    
033            public double noisePercentage = 0;
034            public int maxExecutionTimeInSeconds = 0;
035            public int minExecutionTimeInSeconds = 0;
036            public int guaranteeXgoodDescriptions = 1;
037            
038            public SortedSet<String> ignoredConcepts = new TreeSet<String>();
039            
040            public boolean useAllConstructor = false;
041            public boolean useExistsConstructor = true;
042            public boolean useCardinalityRestrictions = false;
043            public boolean useNegation = false;
044            
045            public boolean writeSearchTree = false;
046            public String searchTreeFile = "log/searchTree.txt";
047            public boolean replaceSearchTree = true;
048            
049            
050            public void applyConfigEntries(ComponentManager cm, AbstractKnowledgeSource ks, AbstractLearningProblem lp, AbstractReasonerComponent rs, AbstractCELA la) {
051                    try {
052                            
053                            // LEARNINGALGORITHM
054                            cm.applyConfigEntry(la, "useAllConstructor", useAllConstructor);
055                            cm.applyConfigEntry(la, "useExistsConstructor", useExistsConstructor);
056                            cm.applyConfigEntry(la, "useCardinalityRestrictions", useCardinalityRestrictions);
057                            cm.applyConfigEntry(la, "useNegation", useNegation);
058                            
059                            cm.applyConfigEntry(la, "minExecutionTimeInSeconds", minExecutionTimeInSeconds);
060                            cm.applyConfigEntry(la, "maxExecutionTimeInSeconds",
061                                            maxExecutionTimeInSeconds);
062                            cm.applyConfigEntry(la, "guaranteeXgoodDescriptions",
063                                            guaranteeXgoodDescriptions);
064                            
065                            cm.applyConfigEntry(la, "writeSearchTree", writeSearchTree);
066                            cm.applyConfigEntry(la, "searchTreeFile", searchTreeFile);
067                            cm.applyConfigEntry(la, "replaceSearchTree", replaceSearchTree);
068                            
069                            cm.applyConfigEntry(la, "noisePercentage", noisePercentage);
070                            
071                            if(ignoredConcepts.size()>0) {
072                             cm.applyConfigEntry(la,"ignoredConcepts",ignoredConcepts);
073                            }
074    
075                    
076                    } catch (Exception e) {
077                            e.printStackTrace();
078                    }
079                    // return null;
080    
081            }
082    }