List of usage examples for org.apache.commons.configuration Configuration getInt
int getInt(String key, int defaultValue);
From source file:net.sf.jclal.listener.ClassicalReporterListener.java
/** * * @param configuration The configuration of Classical Reporter Listener. * * The XML labels supported are://from w w w .j a v a 2s .co m * * <ul> * <li><b>report-title= String</b>, default= untitled</li> * <li><b>report-directory= String</b>, default= reports</li> * <li><b>report-frequency= int</b></li> * <li><b>report-on-console= boolean</b></li> * <li><b>report-on-file= boolean</b></li> * <li><b>send-email= class</b> * <p> * Package: net.sf.jclal.util.mail</p> * Class: All * </li> * </ul> */ @Override public void configure(Configuration configuration) { // Set report title (default "untitled") String reportTitleT = configuration.getString("report-title", reportTitle); setReportTitle(reportTitleT); // Set report title (default "reports/") String reportDirectoryT = configuration.getString("report-directory", reportDirectory); setReportDirectory(reportDirectoryT); // Set report frequency (default 1 iteration) int reportFrequencyT = configuration.getInt("report-frequency", reportFrequency); setReportFrequency(reportFrequencyT); // Set console report (default on) boolean reportOnConsoleT = configuration.getBoolean("report-on-console", reportOnConsole); setReportOnConsole(reportOnConsoleT); // Set file report (default off) boolean reportOnFileT = configuration.getBoolean("report-on-file", reportOnFile); setReportOnFile(reportOnFileT); String sendError = "send-email type= "; try { String senderEmailClassname = configuration.getString("send-email[@type]"); sendError += senderEmailClassname; //If a email sender was especified if (senderEmailClassname != null) { // sender email class Class<?> senderEmailClass = Class.forName(senderEmailClassname); SenderEmail senderEmailT = (SenderEmail) senderEmailClass.newInstance(); // Configure listener (if necessary) if (senderEmailT instanceof IConfigure) { ((IConfigure) senderEmailT).configure(configuration.subset("send-email")); } setSenderEmail(senderEmailT); } } catch (ClassNotFoundException e) { throw new ConfigurationRuntimeException("\nIllegal sender email classname: " + sendError, e); } catch (InstantiationException e) { throw new ConfigurationRuntimeException("\nIllegal sender email classname: " + sendError, e); } catch (IllegalAccessException e) { throw new ConfigurationRuntimeException("\nIllegal sender email classname: " + sendError, e); } }
From source file:dk.dma.ais.abnormal.analyzer.analysis.DriftAnalysis.java
@Inject public DriftAnalysis(Configuration configuration, AppStatisticsService statisticsService, EventEmittingTracker trackingService, EventRepository eventRepository) { super(eventRepository, trackingService, null); this.statisticsService = statisticsService; setTrackPredictionTimeMax(configuration.getInteger(CONFKEY_ANALYSIS_DRIFT_PREDICTIONTIME_MAX, -1)); SPEED_HIGH_MARK = configuration.getFloat(CONFKEY_ANALYSIS_DRIFT_SOG_MAX, 5.0f); SPEED_LOW_MARK = configuration.getFloat(CONFKEY_ANALYSIS_DRIFT_SOG_MIN, 1.0f); MIN_HDG_COG_DEVIATION_DEGREES = configuration.getFloat(CONFKEY_ANALYSIS_DRIFT_COGHDG, 45f); OBSERVATION_PERIOD_MINUTES = configuration.getInt(CONFKEY_ANALYSIS_DRIFT_PERIOD, 10); OBSERVATION_DISTANCE_METERS = configuration.getFloat(CONFKEY_ANALYSIS_DRIFT_DISTANCE, 500f); SHIP_LENGTH_MIN = configuration.getInt(CONFKEY_ANALYSIS_DRIFT_SHIPLENGTH_MIN, 50); LOG.info(this.getClass().getSimpleName() + " created (" + this + ")."); }
From source file:dk.dma.ais.abnormal.analyzer.analysis.SuddenSpeedChangeAnalysis.java
@Inject public SuddenSpeedChangeAnalysis(Configuration configuration, AppStatisticsService statisticsService, EventEmittingTracker trackingService, EventRepository eventRepository) { super(eventRepository, trackingService, null); this.statisticsService = statisticsService; setTrackPredictionTimeMax(//w ww . j ava2 s. c om configuration.getInteger(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_PREDICTIONTIME_MAX, -1)); SPEED_HIGH_MARK = configuration.getFloat(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_SOG_HIGHMARK, 7f); SPEED_LOW_MARK = configuration.getFloat(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_SOG_LOWMARK, 1f); SPEED_DECAY_SECS = configuration.getInt(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_DROP_DECAY, 30); SPEED_SUSTAIN_SECS = configuration.getInt(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_DROP_SUSTAIN, 60); SHIP_LENGTH_MIN = configuration.getInt(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_SHIPLENGTH_MIN, 50); LOG.info(getAnalysisName() + " created (" + this + ")."); }
From source file:com.yahoo.omid.tsoclient.TSOClientImpl.java
TSOClientImpl(Configuration conf, MetricRegistry metrics) { this.metrics = metrics; // Start client with Nb of active threads = 3 as maximum. int tsoExecutorThreads = conf.getInt(TSO_EXECUTOR_THREAD_NUM_CONFKEY, DEFAULT_TSO_EXECUTOR_THREAD_NUM); factory = new NioClientSocketChannelFactory( Executors/*from ww w . j av a2 s. c o m*/ .newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("tsoclient-boss-%d").build()), Executors.newCachedThreadPool( new ThreadFactoryBuilder().setNameFormat("tsoclient-worker-%d").build()), tsoExecutorThreads); // Create the bootstrap bootstrap = new ClientBootstrap(factory); requestTimeoutMs = conf.getInt(REQUEST_TIMEOUT_IN_MS_CONFKEY, DEFAULT_REQUEST_TIMEOUT_MS); requestMaxRetries = conf.getInt(REQUEST_MAX_RETRIES_CONFKEY, DEFAULT_TSO_MAX_REQUEST_RETRIES); retryDelayMs = conf.getInt(TSO_RETRY_DELAY_MS_CONFKEY, DEFAULT_TSO_RETRY_DELAY_MS); LOG.info("Connecting to TSO..."); // Try to connect to TSO from ZK. If fails, go through host:port config try { connectToZK(conf); configureCurrentTSOServerZNodeCache(); HostAndPort hp = getCurrentTSOHostAndPortFoundInZK(); LOG.info("\t* Current TSO host:port found in ZK: {}", hp); setTSOAddress(hp.getHostText(), hp.getPort()); } catch (ZKException e) { LOG.warn("A problem connecting to TSO was found ({}). Trying to connect directly with host:port", e.getMessage()); String host = conf.getString(TSO_HOST_CONFKEY); int port = conf.getInt(TSO_PORT_CONFKEY, DEFAULT_TSO_PORT); if (host == null) { throw new IllegalArgumentException("tso.host missing from configuration"); } setTSOAddress(host, port); } fsmExecutor = Executors .newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat("tsofsm-%d").build()); fsm = new FsmImpl(fsmExecutor); fsm.setInitState(new DisconnectedState(fsm)); ChannelPipeline pipeline = bootstrap.getPipeline(); pipeline.addLast("lengthbaseddecoder", new LengthFieldBasedFrameDecoder(8 * 1024, 0, 4, 0, 4)); pipeline.addLast("lengthprepender", new LengthFieldPrepender(4)); pipeline.addLast("protobufdecoder", new ProtobufDecoder(TSOProto.Response.getDefaultInstance())); pipeline.addLast("protobufencoder", new ProtobufEncoder()); pipeline.addLast("handler", new Handler(fsm)); bootstrap.setOption("tcpNoDelay", true); bootstrap.setOption("keepAlive", true); bootstrap.setOption("reuseAddress", true); bootstrap.setOption("connectTimeoutMillis", 100); }
From source file:com.cisco.oss.foundation.http.netlifx.apache.ApacheNetflixHttpClient.java
private InternalServerProxyMetadata loadServersMetadataConfiguration() { Configuration subset = ConfigurationFactory.getConfiguration().subset(getApiName()); final Iterator<String> keysIterator = subset.getKeys(); // read default values int readTimeout = subset.getInt("http." + LoadBalancerConstants.READ_TIME_OUT, LoadBalancerConstants.DEFAULT_READ_TIMEOUT); int connectTimeout = subset.getInt("http." + LoadBalancerConstants.CONNECT_TIME_OUT, LoadBalancerConstants.DEFAULT_CONNECT_TIMEOUT); long waitingTime = subset.getLong("http." + LoadBalancerConstants.WAITING_TIME, LoadBalancerConstants.DEFAULT_WAITING_TIME); int numberOfAttempts = subset.getInt("http." + LoadBalancerConstants.NUMBER_OF_ATTEMPTS, LoadBalancerConstants.DEFAULT_NUMBER_OF_ATTEMPTS); long retryDelay = subset.getLong("http." + LoadBalancerConstants.RETRY_DELAY, LoadBalancerConstants.DEFAULT_RETRY_DELAY); long idleTimeout = subset.getLong("http." + LoadBalancerConstants.IDLE_TIME_OUT, LoadBalancerConstants.DEFAULT_IDLE_TIMEOUT); int maxConnectionsPerAddress = subset.getInt("http." + LoadBalancerConstants.MAX_CONNECTIONS_PER_ADDRESS, LoadBalancerConstants.DEFAULT_MAX_CONNECTIONS_PER_ADDRESS); int maxConnectionsTotal = subset.getInt("http." + LoadBalancerConstants.MAX_CONNECTIONS_TOTAL, LoadBalancerConstants.DEFAULT_MAX_CONNECTIONS_TOTAL); int maxQueueSizePerAddress = subset.getInt("http." + LoadBalancerConstants.MAX_QUEUE_PER_ADDRESS, LoadBalancerConstants.DEFAULT_MAX_QUEUE_PER_ADDRESS); boolean followRedirects = subset.getBoolean("http." + LoadBalancerConstants.FOLLOW_REDIRECTS, false); boolean disableCookies = subset.getBoolean("http." + LoadBalancerConstants.DISABLE_COOKIES, false); boolean autoCloseable = subset.getBoolean("http." + LoadBalancerConstants.AUTO_CLOSEABLE, true); boolean autoEncodeUri = subset.getBoolean("http." + LoadBalancerConstants.AUTO_ENCODE_URI, true); boolean staleConnectionCheckEnabled = subset .getBoolean("http." + LoadBalancerConstants.IS_STALE_CONN_CHECK_ENABLED, false); boolean serviceDirectoryEnabled = subset .getBoolean("http." + LoadBalancerConstants.SERVICE_DIRECTORY_IS_ENABLED, false); String serviceName = subset.getString("http." + LoadBalancerConstants.SERVICE_DIRECTORY_SERVICE_NAME, "UNKNOWN"); String keyStorePath = subset.getString("http." + LoadBalancerConstants.KEYSTORE_PATH, ""); String keyStorePassword = subset.getString("http." + LoadBalancerConstants.KEYSTORE_PASSWORD, ""); String trustStorePath = subset.getString("http." + LoadBalancerConstants.TRUSTSTORE_PATH, ""); String trustStorePassword = subset.getString("http." + LoadBalancerConstants.TRUSTSTORE_PASSWORD, ""); startEurekaClient = subset.getBoolean("http.startEurekaClient", true); final List<String> keys = new ArrayList<String>(); while (keysIterator.hasNext()) { String key = keysIterator.next(); keys.add(key);/*w ww . j a v a 2 s . c om*/ } Collections.sort(keys); List<Pair<String, Integer>> hostAndPortPairs = new CopyOnWriteArrayList<Pair<String, Integer>>(); for (String key : keys) { if (key.contains(LoadBalancerConstants.HOST)) { String host = subset.getString(key); // trim the host name if (org.apache.commons.lang.StringUtils.isNotEmpty(host)) { host = host.trim(); } final String portKey = key.replace(LoadBalancerConstants.HOST, LoadBalancerConstants.PORT); if (subset.containsKey(portKey)) { int port = subset.getInt(portKey); // save host and port for future creation of server list hostAndPortPairs.add(Pair.of(host, port)); } } } InternalServerProxyMetadata metadata = new InternalServerProxyMetadata(readTimeout, connectTimeout, idleTimeout, maxConnectionsPerAddress, maxConnectionsTotal, maxQueueSizePerAddress, waitingTime, numberOfAttempts, retryDelay, hostAndPortPairs, keyStorePath, keyStorePassword, trustStorePath, trustStorePassword, followRedirects, autoCloseable, staleConnectionCheckEnabled, disableCookies, serviceDirectoryEnabled, serviceName, autoEncodeUri); // metadata.getHostAndPortPairs().addAll(hostAndPortPairs); // metadata.setReadTimeout(readTimeout); // metadata.setConnectTimeout(connectTimeout); // metadata.setNumberOfRetries(numberOfAttempts); // metadata.setRetryDelay(retryDelay); // metadata.setWaitingTime(waitingTime); return metadata; }
From source file:com.linkedin.pinot.broker.requesthandler.BrokerRequestHandler.java
public BrokerRequestHandler(RoutingTable table, TimeBoundaryService timeBoundaryService, ScatterGather scatterGatherer, ReduceServiceRegistry reduceServiceRegistry, BrokerMetrics brokerMetrics, Configuration config) { _routingTable = table;//from w w w.j ava2 s.c o m _timeBoundaryService = timeBoundaryService; _reduceServiceRegistry = reduceServiceRegistry; _scatterGatherer = scatterGatherer; _replicaSelection = new RoundRobinReplicaSelection(); _brokerMetrics = brokerMetrics; _optimizer = new BrokerRequestOptimizer(); _requestIdGenerator = new AtomicLong(0); _queryResponseLimit = config.getInt(BROKER_QUERY_RESPONSE_LIMIT_CONFIG, DEFAULT_BROKER_QUERY_RESPONSE_LIMIT); _brokerTimeOutMs = config.getLong(BROKER_TIME_OUT_CONFIG, DEFAULT_BROKER_TIME_OUT_MS); _brokerId = config.getString(BROKER_ID_CONFIG_KEY, DEFAULT_BROKER_ID); LOGGER.info("Broker response limit is: " + _queryResponseLimit); LOGGER.info("Broker timeout is - " + _brokerTimeOutMs + " ms"); LOGGER.info("Broker id: " + _brokerId); }
From source file:dk.dma.ais.abnormal.analyzer.AbnormalAnalyzerAppModule.java
@Provides @Singleton/*from www . j av a 2s. c om*/ EventRepository provideEventRepository() { SessionFactory sessionFactory; Configuration configuration = getConfiguration(); String eventRepositoryType = configuration.getString(CONFKEY_EVENTS_REPOSITORY_TYPE); try { if ("h2".equalsIgnoreCase(eventRepositoryType)) { sessionFactory = JpaSessionFactoryFactory .newH2SessionFactory(new File(configuration.getString(CONFKEY_EVENTS_H2_FILE))); } else if ("pgsql".equalsIgnoreCase(eventRepositoryType)) { sessionFactory = JpaSessionFactoryFactory.newPostgresSessionFactory( configuration.getString(CONFKEY_EVENTS_PGSQL_HOST), configuration.getInt(CONFKEY_EVENTS_PGSQL_PORT, 8432), configuration.getString(CONFKEY_EVENTS_PGSQL_NAME), configuration.getString(CONFKEY_EVENTS_PGSQL_USERNAME), configuration.getString(CONFKEY_EVENTS_PGSQL_PASSWORD)); } else { throw new IllegalArgumentException("eventRepositoryType: " + eventRepositoryType); } } catch (HibernateException e) { LOG.error(e.getMessage(), e); throw e; } return new JpaEventRepository(sessionFactory, false); }
From source file:com.salesmanager.central.profile.ProfileAction.java
public String display() { try {/*from w w w.ja v a 2 s. co m*/ //@TODO set security questions and answers super.setPageTitle("label.menu.group.profile"); SecurityQuestionsModule module = (SecurityQuestionsModule) SpringUtil.getBean("securityQuestions"); Map questions = module.getSecurityQuestions(super.getLocale()); this.setSecurityQuestions(questions); MerchantService mservice = (MerchantService) ServiceFactory.getService(ServiceFactory.MerchantService); merchantProfile = mservice .getMerchantUserInformation(super.getPrincipal().getUserPrincipal().getName()); if (merchantProfile == null) {// should be created from the original // subscribtion process log.error("Profile does not exist for merchantid " + super.getPrincipal().getRemoteUser()); MessageUtil.addErrorMessage(super.getServletRequest(), LabelUtil.getInstance().getText("errors.technical")); return ERROR; } // NEED TO SET COUNTRY ID IN THE SESSION IN ORDER TO RETREIVE // ASSOCIATE PROVINCES if (merchantProfile.getUsercountrycode() == 0) {// original default // country code Configuration conf = PropertiesUtil.getConfiguration(); int defaultCountry = conf.getInt("core.system.defaultcountryid", Constants.US_COUNTRY_ID); MessageUtil.addNoticeMessage(super.getServletRequest(), LabelUtil.getInstance().getText("messages.updateinformation")); merchantProfile.setUsercountrycode(defaultCountry); super.prepareSelections(defaultCountry); } else { super.prepareSelections(merchantProfile.getUsercountrycode()); } if (!StringUtils.isBlank(merchantProfile.getSecurityQuestion1()) || !StringUtils.isBlank(merchantProfile.getSecurityQuestion2()) || !StringUtils.isBlank(merchantProfile.getSecurityQuestion3())) { answers.add(0, Integer.parseInt(merchantProfile.getSecurityQuestion1())); answers.add(1, Integer.parseInt(merchantProfile.getSecurityQuestion2())); answers.add(2, Integer.parseInt(merchantProfile.getSecurityQuestion3())); answersText.add(0, merchantProfile.getSecurityAnswer1()); answersText.add(1, merchantProfile.getSecurityAnswer2()); answersText.add(2, merchantProfile.getSecurityAnswer3()); } /** * //@todo get credit card //parse expiration date to mm yy format * String ccDate = profile.getCcExpires(); if(ccDate!=null && * !ccDate.equals("")) { int length = ccDate.length(); String ccm = * null; String ccy = null; if(length==4) { ccm = * ccDate.substring(0,2); ccy = ccDate.substring(3); } else { ccm = * "0" + ccDate.substring(0,1); ccy = ccDate.substring(2); } * this.setCcYear(ccy); this.setCcMonth(ccm); * * this.setSecurityCode(new String(profile.getCcCvv())); } else { * java.util.Calendar cal = new java.util.GregorianCalendar(); * this.setCcYear * (String.valueOf((cal.get(java.util.Calendar.YEAR)))); * this.setCcMonth * (String.valueOf((cal.get(java.util.Calendar.MONTH)))); * this.setSecurityCode(""); } * * * if(profile.getCcNumber()!=null && * !profile.getCcNumber().trim().equals("")) { //decrypt credit card * String decryptedvalue = * EncryptionUtil.decrypt(EncryptionUtil.generatekey * (String.valueOf(merchantid.intValue())), profile.getCcNumber()); * //mask value CreditCardUtil util = new CreditCardUtil(); String * card = util.maskCardNumber(decryptedvalue); * profile.setCcNumber(card); } **/ // } } catch (Exception e) { MessageUtil.addErrorMessage(super.getServletRequest(), LabelUtil.getInstance().getText("errors.technical")); log.error(e); } return SUCCESS; }
From source file:com.cisco.oss.foundation.http.server.jetty.JettyHttpServerFactory.java
private void getConnectors(List<String> startupLogs, List<Connector> connectors, boolean useHttpsOnly, String logicalName, String serviceName, String keyStorePath, String keyStorePassword, String trustStorePath, String trustStorePassword, Configuration configuration, String host, int port, int connectionIdleTime, boolean isBlockingChannelConnector, int numberOfAcceptors, int acceptQueueSize) { AbstractConnector connector = null;// ww w .j av a 2 s . c o m if (isBlockingChannelConnector) { connector = new BlockingChannelConnector(); } else { connector = new SelectChannelConnector(); } connector.setAcceptQueueSize(acceptQueueSize); connector.setAcceptors(numberOfAcceptors); connector.setPort(port); connector.setHost(host); connector.setMaxIdleTime(connectionIdleTime); connector.setRequestHeaderSize( configuration.getInt(serviceName + ".http.requestHeaderSize", connector.getRequestHeaderSize())); if (logicalName != null) { connector.setName(logicalName); } boolean isSSL = StringUtils.isNotBlank(keyStorePath) && StringUtils.isNotBlank(keyStorePassword); int sslPort = -1; SslSelectChannelConnector sslSelectChannelConnector = null; if (isSSL) { String sslHost = configuration.getString(serviceName + ".https.host", "0.0.0.0"); sslPort = configuration.getInt(serviceName + ".https.port", 8090); SslContextFactory sslContextFactory = new SslContextFactory(); sslContextFactory.setKeyStorePath(keyStorePath); sslContextFactory.setKeyStorePassword(keyStorePassword); boolean addTrustStoreSupport = StringUtils.isNotEmpty(trustStorePath) && StringUtils.isNotEmpty(trustStorePassword); if (addTrustStoreSupport) { sslContextFactory.setTrustStore(trustStorePath); sslContextFactory.setTrustStorePassword(trustStorePassword); sslContextFactory.setNeedClientAuth(true); } sslSelectChannelConnector = new SslSelectChannelConnector(sslContextFactory); sslSelectChannelConnector.setHost(sslHost); sslSelectChannelConnector.setPort(sslPort); if (logicalName != null) { sslSelectChannelConnector.setName(logicalName); } if (useHttpsOnly) { sslSelectChannelConnector.setAcceptQueueSize(acceptQueueSize); sslSelectChannelConnector.setAcceptors(numberOfAcceptors); sslSelectChannelConnector.setMaxIdleTime(connectionIdleTime); sslSelectChannelConnector.setRequestHeaderSize(configuration.getInt( serviceName + ".http.requestHeaderSize", sslSelectChannelConnector.getRequestHeaderSize())); connectors.add(sslSelectChannelConnector); startupLogs.add("Https server: " + serviceName + " started on " + sslPort); } else { startupLogs.add("Https server: " + serviceName + " started on " + sslPort); startupLogs.add("Http server: " + serviceName + " started on " + port); connectors.add(connector); connectors.add(sslSelectChannelConnector); } } else { startupLogs.add("Http server: " + serviceName + " started on " + port); connectors.add(connector); } }
From source file:keel.Algorithms.Neural_Networks.NNEP_Common.mutators.structural.StructuralMutator.java
/** * <p>/*from w w w . j a v a 2s . com*/ * Configuration parameters for StructuralMutator are: * </p> * @params settings Settings to configure * <ul> * <li> * <code>temperature-exponent[@value] double (default=1)</code></p> * Temperature exponent to be used for obtaining temperature * of each indivual mutated. * </li> * <li> * <code>significative-weigth[@value] double (default=0.0000001)</code></p> * Minimum value of new weigths. * </li> * <li> * <code>neurons-ranges: complex</code></p> * Ranges of neurons added or deleted. * <ul> * <li> * <code>neurons-ranges.added: complex</code> * Ranges of neurons added. * <ul> * <li> * <code>neurons-ranges.added[@min] int (default=1)</code> * Minimum number of added neurons. * </li> * <li> * <code>neurons-ranges.added[@max] int (default=2)</code> * Maximum number of added neurons. * </li> * </ul> * </li> * <li> * <code>neurons-ranges.deleted: complex</code> * Ranges of neurons deleted. * <ul> * <li> * <code>neurons-ranges.deleted[@min] int (default=1)</code> * Minimum number of deleted neurons. * </li> * <li> * <code>neurons-ranges.deleted[@max] int (default=2)</code> * Maximum number of deleted neurons. * </li> * </ul> * </li> * </ul> * </li> * <li> * <code>links-ranges: complex</code></p> * Ranges of links added or deleted. * <ul> * <li> * <code>links-ranges[@relative] boolean (default=false)</code> * If we use a relative number of links, then we have to specify * a percentage of links added or deleted, dependind of the layer * operated * </li> * <li> * <code>links-ranges.added: complex</code> * Ranges of absolute number of links added * (when <code>links-ranges.relative = false </code>). * <ul> * <li> * <code>links-ranges.added[@min] int (default=1)</code> * Minimum number of added links. * </li> * <li> * <code>links-ranges.added[@max] int (default=6)</code> * Maximum number of added links. * </li> * </ul> * </li> * <li> * <code>links-ranges.deleted: complex</code> * Ranges of absolute number of links deleted * (when <code>links-ranges.relative = false </code>). * <ul> * <li> * <code>links-ranges.deleted[@min] int (default=1)</code> * Minimum number of deleted links. * </li> * <li> * <code>links-ranges.deleted[@max] int (default=6)</code> * Maximum number of deleted links. * </li> * </ul> * </li> * <li> * <code>links-ranges.percentages: complex</code> * Percentages of links added and deleted * (when <code>links-ranges.relative = true </code>). * <ul> * <li> * <code>links-ranges.percentages[@hidden] int (default=30)</code> * Percentage of links added/deleted of each neuron of a hidden layer. * </li> * <li> * <code>links-ranges.percentages[@output] int (default=5)</code> * Percentage of links added/deleted of each neuron of an output layer. * </li> * </ul> * </li> * </ul> * </li> * </ul> */ public void configure(Configuration settings) { // Setup pr temperExponent = settings.getDouble("temperature-exponent[@value]", 1); // Setup significativeWeigth significativeWeigth = settings.getDouble("significative-weigth[@value]", 0.0000001); // Setup neurons mutation parameters minNeuronsAdd = settings.getInt("neurons-ranges.added[@min]", 1); maxNeuronsAdd = settings.getInt("neurons-ranges.added[@max]", 2); minNeuronsDel = settings.getInt("neurons-ranges.deleted[@min]", 1); maxNeuronsDel = settings.getInt("neurons-ranges.deleted[@max]", 2); // Setup links mutation parameters nOfLinksRelative = settings.getBoolean("links-ranges[@relative]", false); if (!nOfLinksRelative) { minLinksAdd = settings.getInt("links-ranges.added[@min]", 1); maxLinksAdd = settings.getInt("links-ranges.added[@max]", 6); minLinksDel = settings.getInt("links-ranges.deleted[@min]", 1); maxLinksDel = settings.getInt("links-ranges.deleted[@max]", 6); } else { hiddenLinksPercentage = settings.getInt("links-ranges.percentages[@hidden]", 30); outputLinksPercentage = settings.getInt("links-ranges.percentages[@output]", 5); } }