当前位置: 首页>>代码示例>>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;未经允许,请勿转载。