當前位置: 首頁>>代碼示例>>Java>>正文


Java ParameterConfiguration.updateChecksum方法代碼示例

本文整理匯總了Java中edacc.parameterspace.ParameterConfiguration.updateChecksum方法的典型用法代碼示例。如果您正苦於以下問題:Java ParameterConfiguration.updateChecksum方法的具體用法?Java ParameterConfiguration.updateChecksum怎麽用?Java ParameterConfiguration.updateChecksum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edacc.parameterspace.ParameterConfiguration的用法示例。


在下文中一共展示了ParameterConfiguration.updateChecksum方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getConstrainedNeighbourhood

import edacc.parameterspace.ParameterConfiguration; //導入方法依賴的package包/類
/**
 * Returns all parameter configurations that are considered neighbours of the given configuration.
 * This neighbourhood is constrained to values that are located in the same AND-nodes as the values
 * of the given configuration. 
 * @param config
 * @return (constrained) list of all neighbouring configurations
 */
public List<ParameterConfiguration> getConstrainedNeighbourhood(ParameterConfiguration config) {
	Set<OrNode> assigned_or_nodes = new HashSet<OrNode>();
	Set<AndNode> assigned_and_nodes = new HashSet<AndNode>();
	for (Parameter p: config.getParameter_instances().keySet()) {
   		for (AndNode n: getAndNodes()) {
   			if (n == startNode) continue;
   			if (n.getParameter().equals(p) && n.getDomain().contains(config.getParameterValue(p))) {
   				assigned_or_nodes.add(preceedingNode(n));
   				assigned_and_nodes.add(n);
   			}
   		}
	}
	
	List<ParameterConfiguration> nbh = new LinkedList<ParameterConfiguration>();
	for (AndNode node: assigned_and_nodes) {
	    if (fixedParameters.containsKey(node.getParameter())) continue;
		for (Object value: preceedingNode(node).getParameter().getDomain().getDiscreteValues()) {
			if (node.getDomain().contains(value)) { // same subdomain, different value
				if (valuesEqual(value, config.getParameterValue(node.getParameter()))) continue;
				ParameterConfiguration neighbour = new ParameterConfiguration(config);
				neighbour.setParameterValue(node.getParameter(), value);
				if (calculateChecksums) neighbour.updateChecksum();
				nbh.add(neighbour);
			}
		}
		
	}
	
	return nbh;
}
 
開發者ID:EDACC,項目名稱:edacc_api,代碼行數:38,代碼來源:ParameterGraph.java

示例2: crossover2Point

import edacc.parameterspace.ParameterConfiguration; //導入方法依賴的package包/類
/**
 * Two point crossover operator
 * @param config1
 * @param config2
 * @param rng
 * @return
 */
public Pair<ParameterConfiguration, ParameterConfiguration> crossover2Point(ParameterConfiguration config1, ParameterConfiguration config2, Random rng) {
       Map<Node, Integer> colors = new HashMap<Node, Integer>();
       int currentColor = 1;
       for (Node node: adjacentNodes(startNode)) {
           int c = colorDFS(node, currentColor, colors);
           if (c == currentColor) currentColor++;
       }

       ParameterConfiguration c1 = new ParameterConfiguration(parameters);
       ParameterConfiguration c2 = new ParameterConfiguration(parameters);
       int crossoverFirstColor = rng.nextInt(currentColor / 2) + 1;
       int crossoverSecondColor = rng.nextInt(currentColor / 2 + 1) + 1 + currentColor / 2;
       
       for (int col = 1; col < currentColor; col++) {
           for (Node n: colors.keySet()) {
               if (colors.get(n) == col) {
                   if (col <= crossoverFirstColor) { // first section (unchanged)
                       c1.setParameterValue(n.getParameter(), config1.getParameterValue(n.getParameter()));
                       c2.setParameterValue(n.getParameter(), config2.getParameterValue(n.getParameter()));
                   } else if (col <= crossoverSecondColor) { // second section (swap)
                       c1.setParameterValue(n.getParameter(), config2.getParameterValue(n.getParameter()));
                       c2.setParameterValue(n.getParameter(), config1.getParameterValue(n.getParameter()));
                   } else { // third section (unchanged)
                       c1.setParameterValue(n.getParameter(), config1.getParameterValue(n.getParameter()));
                       c2.setParameterValue(n.getParameter(), config2.getParameterValue(n.getParameter()));
                   }
               }
           }
       }
       
       if (calculateChecksums) c1.updateChecksum();
       if (calculateChecksums) c2.updateChecksum();
    return new Pair<ParameterConfiguration, ParameterConfiguration>(c1, c2);
}
 
開發者ID:EDACC,項目名稱:edacc_api,代碼行數:42,代碼來源:ParameterGraph.java

示例3: getGaussianNeighbourhoodFast

import edacc.parameterspace.ParameterConfiguration; //導入方法依賴的package包/類
public List<ParameterConfiguration> getGaussianNeighbourhoodFast(ParameterConfiguration config,
           Random rng, float stdDevFactor, int numSamples, boolean gaussianOrdinal) {
    List<ParameterConfiguration> nbh = new ArrayList<ParameterConfiguration>();
    for (Parameter p: config.getParameter_instances().keySet()) {
        if (fixedParameters.containsKey(p)) continue;
           for (Object v:  p.getDomain().getGaussianDiscreteValues(rng, config.getParameterValue(p), stdDevFactor, numSamples)) {
               if (valuesEqual(v, config.getParameterValue(p))) continue; // same value as current -> skip
               ParameterConfiguration neighbour = new ParameterConfiguration(config);
               neighbour.setParameterValueFast(p, v);
               if (calculateChecksums) neighbour.updateChecksum();
               nbh.add(neighbour);
           }
    }
    return nbh;
}
 
開發者ID:EDACC,項目名稱:edacc_api,代碼行數:16,代碼來源:ParameterGraph.java

示例4: getNeighbourhood

import edacc.parameterspace.ParameterConfiguration; //導入方法依賴的package包/類
/**
 * Returns all parameter configurations that are considered neighbours of the given configuration.
 * TODO: use generalized algorithm instead of the "same-AND-node" constrained neighbourhood. 
 * @param config The configuration of which the neighbourhood should be generated.
 * @return list of all neighbouring configurations
 */
public List<ParameterConfiguration> getNeighbourhood(ParameterConfiguration config) {
	Set<OrNode> assigned_or_nodes = new HashSet<OrNode>();
	Set<AndNode> assigned_and_nodes = new HashSet<AndNode>();
	for (Parameter p: config.getParameter_instances().keySet()) {
   		for (AndNode n: getAndNodes()) {
   			if (n == startNode) continue;
   			if (n.getParameter().equals(p) && n.getDomain().contains(config.getParameterValue(p))) {
   				assigned_or_nodes.add(preceedingNode(n));
   				assigned_and_nodes.add(n);
   			}
   		}
	}
	
	List<ParameterConfiguration> nbh = new LinkedList<ParameterConfiguration>();
	for (AndNode node: assigned_and_nodes) {
		for (Object value: preceedingNode(node).getParameter().getDomain().getDiscreteValues()) {
			if (node.getDomain().contains(value)) { // same subdomain, different value
				if (valuesEqual(value, config.getParameterValue(node.getParameter()))) continue;
				ParameterConfiguration neighbour = new ParameterConfiguration(config);
				neighbour.setParameterValue(node.getParameter(), value);
				neighbour.updateChecksum();
				nbh.add(neighbour);
			}
		}
		
	}
	
	return nbh;
}
 
開發者ID:EDACC,項目名稱:edacc_gui,代碼行數:36,代碼來源:ParameterGraph.java


注:本文中的edacc.parameterspace.ParameterConfiguration.updateChecksum方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。