List of usage examples for org.apache.commons.configuration Configuration getDouble
double getDouble(String key);
From source file:es.udc.gii.common.eaf.plugin.parameter.jade.JADECRAdaptiveParameter.java
@Override public void configure(Configuration conf) { if (conf.containsKey("c")) { this.c = conf.getDouble("c"); } else {//from w w w .j a v a 2 s .c om ConfWarning w = new ConfWarning(this.getClass().getSimpleName() + ".c", this.c); w.warn(); } if (conf.containsKey("std_cr")) { this.std_cr = conf.getDouble("std_cr"); } else { ConfWarning w = new ConfWarning(this.getClass().getSimpleName() + ".std_cr", this.std_cr); w.warn(); } if (conf.containsKey("mu")) { this.mu_cr = conf.getDouble("mu"); } else { ConfWarning w = new ConfWarning(this.getClass().getSimpleName() + ".mu_cr", this.mu_cr); w.warn(); } }
From source file:es.udc.gii.common.eaf.plugin.parameter.jade.JADEFAdaptiveParameter.java
@Override public void configure(Configuration conf) { if (conf.containsKey("c")) { this.c = conf.getDouble("c"); } else {//w w w. j av a 2s .co m ConfWarning w = new ConfWarning(this.getClass().getSimpleName() + ".c", this.c); w.warn(); } if (conf.containsKey("std_f")) { this.std_f = conf.getDouble("std_f"); } else { ConfWarning w = new ConfWarning(this.getClass().getSimpleName() + ".std_f", this.std_f); w.warn(); } if (conf.containsKey("mu")) { this.mu_f = conf.getDouble("mu"); } else { ConfWarning w = new ConfWarning(this.getClass().getSimpleName() + ".mu_f", this.mu_f); w.warn(); } }
From source file:es.udc.gii.common.eaf.algorithm.operator.reproduction.mutation.real_code.MichalewiczNonUniformMutation.java
@Override public void configure(Configuration conf) { try {// ww w . j a v a 2s. com super.configure(conf); if (conf.containsKey("B")) { this.b = conf.getDouble("B"); } if (conf.containsKey("Plugin")) { this.plugin = (StopTestPlugin) Class.forName(conf.getString("Plugin")).newInstance(); } } catch (Exception ex) { ex.printStackTrace(); } }
From source file:es.udc.gii.common.eaf.algorithm.operator.reproduction.mutation.de.mutationStrategy.CurrentToPBestMutationStrategy.java
@Override public void configure(Configuration conf) { ConfWarning w = null;//from ww w . j av a2 s . co m super.configure(conf); if (conf.containsKey("p")) { this.p = conf.getDouble("p"); } else { w = new ConfWarning(this.getClass().getSimpleName() + ".p", this.p); } if (conf.containsKey("archive")) { this.archive = conf.getBoolean("archive"); } else { w = new ConfWarning(this.getClass().getSimpleName() + ".archive", Boolean.toString(this.archive)); } if (w != null) { w.warn(); } }
From source file:es.udc.gii.common.eaf.algorithm.restart.IPOPRestartStrategy.java
@Override public void configure(Configuration conf) { if (conf.containsKey("MaxNumRestarts")) { this.max_num_restarts = conf.getInt("MaxNumRestarts"); } else {//from w w w. j ava2 s . co m ConfWarning w = new ConfWarning(this.getClass().getSimpleName() + ".MaxNumRestarts", this.max_num_restarts); w.warn(); } if (conf.containsKey("IncrPopFactor")) { this.incr_factor = conf.getDouble("IncrPopFactor"); } else { ConfWarning w = new ConfWarning(this.getClass().getSimpleName() + ".IncrPopFactor", this.incr_factor); w.warn(); } }
From source file:com.impetus.kundera.ycsb.runner.YCSBRunner.java
public YCSBRunner(final String propertyFile, final Configuration config) { this.propertyFile = propertyFile; ycsbJarLocation = config.getString("ycsbjar.location"); clientjarlocation = config.getString("clientjar.location"); host = config.getString("hosts"); schema = config.getString("schema"); columnFamilyOrTable = config.getString("columnfamilyOrTable"); releaseNo = config.getDouble("release.no"); runType = config.getString("run.type", "load"); port = config.getInt("port"); password = config.getString("password"); clients = config.getStringArray("clients"); isUpdate = config.containsKey("update"); crudUtils = new HibernateCRUDUtils(); }
From source file:at.salzburgresearch.kmt.zkconfig.ZookeeperConfigurationTest.java
@Test public void testDouble() throws Exception { Configuration config = new ZookeeperConfiguration(zkConnection, 5000, "/test"); final String key = UUID.randomUUID().toString(); final Random random = new Random(); final double val1 = random.nextDouble(); final Double val2 = random.nextDouble(); assertThat(config.getProperty(key), nullValue()); config.setProperty(key, val1); assertEquals(val1, config.getDouble(key), 10e-6); assertEquals(Double.valueOf(val1), config.getDouble(key, val2)); config.setProperty(key, val2); assertEquals(val2, config.getDouble(key), 10e-6); assertEquals(val2, config.getDouble(key, Double.valueOf(val1))); }
From source file:es.udc.gii.common.eaf.algorithm.CMAEvolutionaryAlgorithm.java
@Override public void configure(Configuration conf) { super.configure(conf); try {/*w w w . j a va 2s .c om*/ if (conf.containsKey("InitialX")) { double x = conf.getDouble("InitialX"); this.xMean = new double[] { x }; } else { this.xMean = new double[] { 0.0 }; ConfWarning w = new ConfWarning("EvolutionaryAlgorithm.InitialX", 0.0); w.warn(); } if (conf.containsKey("TypicalX")) { double x = conf.getDouble("TypicalX"); this.typicalX = new double[] { x }; } else { this.typicalX = null; ConfWarning w = new ConfWarning("EvolutionaryAlgorithm.TypicalX", 0.0); w.warn(); } if (conf.containsKey("InitialStandardDeviation")) { this.startsigma = new double[] { conf.getDouble("InitialStandardDeviation") }; } else { this.startsigma = new double[] { 1.0 }; ConfWarning w = new ConfWarning("EvolutionaryAlgorithm.InitialStandardDeviation", 1.0); w.warn(); } if (conf.containsKey("Mu")) { this.mu = conf.getInt("Mu"); } else { this.mu = -1; ConfWarning w = new ConfWarning("EvolutionaryAlgorithm.Mu", this.mu); w.warn(); } if (conf.containsKey("RecombinationType")) { this.recombinationType = (RecombinationType) Class .forName(conf.getString("RecombinationType.Class")).newInstance(); this.recombinationType.configure(conf.subset("RecombinationType")); } else { ConfWarning w = new ConfWarning("EvolutionaryAlgorithm.RecombinationType", this.recombinationType.toString()); w.warn(); } if (conf.containsKey("Cs")) { this.cs = conf.getDouble("Cs"); } else { this.cs = -1; ConfWarning w = new ConfWarning("CMAEvolutionaryAlgorithm.Cs", this.cs); w.warn(); } if (conf.containsKey("Damps")) { this.damps = conf.getDouble("Damps"); } else { this.damps = -1; ConfWarning w = new ConfWarning("CMAEvolutionaryAlgorithm.Damps", this.damps); w.warn(); } if (conf.containsKey("DiagonalCovarianceMatrix")) { this.diagonalCovarianceMatrix = conf.getInt("DiagonalCovarianceMatrix"); } else { this.diagonalCovarianceMatrix = -1; ConfWarning w = new ConfWarning("CMAEvolutionaryAlgorithm.DiagonalCovarianceMatrix", this.diagonalCovarianceMatrix); w.warn(); } } catch (Exception ex) { ex.printStackTrace(); } }
From source file:fr.inria.wimmics.prissma.selection.Matcher.java
public Matcher(Decomposition decomp) { if (decomp == null) this.decomp = new Decomposition(); else/*from w w w.j a v a 2 s .c o m*/ this.decomp = decomp; this.inputGraphContextUnits = new HashSet<ContextUnit>(); this.inputGraphEdges = new HashSet<Edge>(); this.candidates = new HashMap<Integer, List<ETSubgraphIsomorphism>>(); this.winners = new HashMap<Integer, List<ETSubgraphIsomorphism>>(); this.results = new HashSet<URI>(); // read params from property file try { Configuration config = new PropertiesConfiguration("config.properties"); PrissmaProperties.THRESHOLD = config.getDouble("threshold"); PrissmaProperties.MISSING_CTXUNIT_ENTITY_COST = config.getDouble("missing_ctxunit_entity_cost"); PrissmaProperties.MISSING_CTXUNIT_STRING_COST = config.getDouble("missing_ctxunit_string_cost"); PrissmaProperties.DECAY_CONSTANT_TIME = config.getDouble("decay_constant_time"); PrissmaProperties.DECAY_CONSTANT_GEO = config.getDouble("decay_constant_geo"); switch (config.getString("string_similarity")) { case "JARO": PrissmaProperties.STRING_SIMILARITY = StringSimilarity.JARO; break; case "JARO_WINKLER": PrissmaProperties.STRING_SIMILARITY = StringSimilarity.JARO_WINKLER; break; case "MONGE_ELKAN": PrissmaProperties.STRING_SIMILARITY = StringSimilarity.MONGE_ELKAN; break; case "LEVENSTHEIN": PrissmaProperties.STRING_SIMILARITY = StringSimilarity.LEVENSTHEIN; break; case "LIN": PrissmaProperties.STRING_SIMILARITY = StringSimilarity.LIN; break; case "WUPALMER": PrissmaProperties.STRING_SIMILARITY = StringSimilarity.WUPALMER; break; case "PATH": PrissmaProperties.STRING_SIMILARITY = StringSimilarity.PATH; break; default: LOG.error("Similarity measure not supported"); break; } PrissmaProperties.ENTITIES_PATH = config.getString("fresnel_folder"); } catch (ConfigurationException e) { LOG.error("Error reading property file {}", e.getMessage()); } }
From source file:es.udc.gii.common.eaf.algorithm.operator.replace.mmga.PopulationMemoryReplaceOperator.java
@Override public void configure(Configuration conf) { /* Defaults */ int hypDiv = 25; int repCycle = 4; double repPart = 0.666; if (conf.containsKey("HypercubeDivisions")) { hypDiv = conf.getInt("HypercubeDivisions"); } else {//from ww w. j a v a 2s. c o m (new ConfWarning("PopulationMemoryReplaceOperator.Hypercube" + "Divisions", hypDiv)).warn(); } if (conf.containsKey("ReplacementCycle")) { repCycle = conf.getInt("ReplacementCycle"); } else { (new ConfWarning("PopulationMemoryReplaceOperator.Replacement" + "Cycle", repCycle)).warn(); } if (conf.containsKey("ReplaceablePart")) { repPart = conf.getDouble("ReplaceablePart"); } else { (new ConfWarning("PopulationMemoryReplaceOperator.Replaceable" + "Part", repPart)).warn(); } setHypercubeDivisions(hypDiv); setReplacementCycle(repCycle); setReplaceablePartSize((int) ((double) popMemSize * repPart)); }