当前位置: 首页>>代码示例>>Java>>正文


Java ParameterConfiguration.getParameterValue方法代码示例

本文整理汇总了Java中edacc.parameterspace.ParameterConfiguration.getParameterValue方法的典型用法代码示例。如果您正苦于以下问题:Java ParameterConfiguration.getParameterValue方法的具体用法?Java ParameterConfiguration.getParameterValue怎么用?Java ParameterConfiguration.getParameterValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edacc.parameterspace.ParameterConfiguration的用法示例。


在下文中一共展示了ParameterConfiguration.getParameterValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paramDifference

import edacc.parameterspace.ParameterConfiguration; //导入方法依赖的package包/类
public Parameter paramDifference(ParameterConfiguration c1, ParameterConfiguration c2){
    Parameter dif=null;
    int count = 0;
    for(Parameter p : params){
        System.out.println(p.getName()+"  |  "+p.toString());
        if(c1.getParameterValue(p)==null || c2.getParameterValue(p)==null)
            System.out.println("VALUE IS NULL");
        if(!c1.getParameterValue(p).equals(c2.getParameterValue(p))){
            count++;
            dif = p;
        }
    }
    if(count!=1){
        System.out.println("ERROR: ParameterConfigs differ in more or less than 1 Parameter: "
                +count+"!");
    }
    return dif;
}
 
开发者ID:EDACC,项目名称:edacc_aac,代码行数:19,代码来源:ParamEval.java

示例2: testCrossover2Point

import edacc.parameterspace.ParameterConfiguration; //导入方法依赖的package包/类
@Test
public void testCrossover2Point() throws Exception {
       Random rng = new MersenneTwister();
       API api = new APIImpl();
       ParameterGraph pspace = api.loadParameterGraphFromFile("src/edacc/parameterspace/test/sparrow_parameterspace.xml");
       ParameterConfiguration config1 = new ParameterConfiguration(pspace.getParameterSet());
       config1.setParameterValue("ps", 0.1);
       config1.setParameterValue("c1", 1);
       config1.setParameterValue("c2", 1);
       config1.setParameterValue("c3", 11);
       
       ParameterConfiguration config2 = new ParameterConfiguration(pspace.getParameterSet());
       config2.setParameterValue("ps", 0.2);
       config2.setParameterValue("c1", 2);
       config2.setParameterValue("c2", 2);
       config2.setParameterValue("c3", 22);
       
       Pair<ParameterConfiguration, ParameterConfiguration> cross = pspace.crossover2Point(config1, config2, rng);
       ParameterConfiguration c1 = cross.getFirst();
       ParameterConfiguration c2 = cross.getSecond();
       
       for (Parameter p: pspace.parameters) {
           Object p_val1 = c1.getParameterValue(p);
           Object p_val2 = c2.getParameterValue(p);
           assertTrue(config1.getParameterValue(p).equals(p_val1) || config2.getParameterValue(p).equals(p_val1));
           assertTrue(config1.getParameterValue(p).equals(p_val2) || config2.getParameterValue(p).equals(p_val2));
       }
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:29,代码来源:ParameterGraphTest.java

示例3: calculateParameterConfigHash

import edacc.parameterspace.ParameterConfiguration; //导入方法依赖的package包/类
private synchronized String calculateParameterConfigHash(int idExperiment, ParameterConfiguration config) throws Exception {
    ConfigurationScenario cs = getConfigScenario(idExperiment);
    MessageDigest md = MessageDigest.getInstance("SHA");
    // calculate the checksum of the parameter configuration in the context of the experiment's
    // configuration scenario, i.e. consider only configurable parameter values.
    List<ConfigurationScenarioParameter> params = cs.getParameters();
    Collections.sort(params);
    for (ConfigurationScenarioParameter param : params) {
        if (isMagicSolverParameter(param.getParameter().getName()))
            continue;
        if (param.isConfigurable()) {
            edacc.parameterspace.Parameter config_param = null;
            for (edacc.parameterspace.Parameter p : config.getParameter_instances().keySet()) {
                if (p.getName().equals(param.getParameter().getName())) {
                    config_param = p;
                    break;
                }
            }
            if (config_param == null) {
                continue;
            }

            if (config.getParameterValue(config_param) != null
                    && !(config.getParameterValue(config_param) instanceof OptionalDomain.OPTIONS)
                    && !(config.getParameterValue(config_param).equals(FlagDomain.FLAGS.OFF))) {
                md.update(config.getValueRepresentation(config.getParameterValue(config_param)).getBytes());
                
            }
        }
    }
    
    return toHex(md.digest());
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:34,代码来源:APIImpl.java

示例4: exists

import edacc.parameterspace.ParameterConfiguration; //导入方法依赖的package包/类
public synchronized int exists(int idExperiment, ParameterConfiguration config) throws Exception {
    MessageDigest md = MessageDigest.getInstance("SHA");
    ConfigurationScenario cs = getConfigScenario(idExperiment);
    List<ConfigurationScenarioParameter> params = cs.getParameters();
    Collections.sort(params);
    for (ConfigurationScenarioParameter param : params) {
        if (isMagicSolverParameter(param.getParameter().getName()))
            continue;
        if (param.isConfigurable()) {
            edacc.parameterspace.Parameter config_param = null;
            for (edacc.parameterspace.Parameter p : config.getParameter_instances().keySet()) {
                if (p.getName().equals(param.getParameter().getName())) {
                    config_param = p;
                    break;
                }
            }
            if (config_param == null) {
                continue;
            }

            if (config.getParameterValue(config_param) != null
                    && !(config.getParameterValue(config_param) instanceof OptionalDomain.OPTIONS)
                    && !(config.getParameterValue(config_param).equals(FlagDomain.FLAGS.OFF))) {
                md.update(config.getValueRepresentation(config.getParameterValue(config_param)).getBytes());
            }
        }

    }

    SolverConfiguration sc = SolverConfigurationDAO.getByParameterHash(idExperiment, toHex(md.digest()));
    if (sc != null)
        return sc.getId();
    return 0;
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:35,代码来源:APIImpl.java

示例5: paramConfigToTuple

import edacc.parameterspace.ParameterConfiguration; //导入方法依赖的package包/类
private double[] paramConfigToTuple(ParameterConfiguration paramConfig, List<Parameter> configurableParameters) {
    double[] theta = new double[configurableParameters.size()];
    for (Parameter p: configurableParameters) {
        int pIx = configurableParameters.indexOf(p);
        Object paramValue = paramConfig.getParameterValue(p);
        if (paramValue == null) theta[pIx] = Double.NaN;
        else {
            if (p.getDomain() instanceof RealDomain) {
                if (paramValue instanceof Float) {
                    theta[pIx] = (Float)paramValue;
                } else if (paramValue instanceof Double) {
                    theta[pIx] = (Double)paramValue;
                }
            } else if (p.getDomain() instanceof IntegerDomain) {
                if (paramValue instanceof Integer) {
                    theta[pIx] = (Integer)paramValue;
                } else if (paramValue instanceof Long) {
                    theta[pIx] = (Long)paramValue;
                }
            } else if (p.getDomain() instanceof CategoricalDomain) {
                theta[pIx] = catDomainMap.get(p).get((String)paramValue);
            } else if (p.getDomain() instanceof OrdinalDomain) {
                // map ordinal parameters to integers 1 through domain.size, 0 = not set
                Map<String, Integer> valueMap = new HashMap<String, Integer>();
                int intVal = 1;
                for (String val: ((OrdinalDomain)p.getDomain()).getOrdered_list()) {
                    valueMap.put(val, intVal++);
                }
                
                theta[pIx] = valueMap.get((String)paramValue);
            } else if (p.getDomain() instanceof FlagDomain) {
                // map flag parameters to {0, 1}
                if (FlagDomain.FLAGS.ON.equals(paramValue)) theta[pIx] = 2;
                else theta[pIx] = 1;
            } else {
                // TODO
                theta[pIx] = paramValue.hashCode();
            }
        }
        
    }
    
    return theta;
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:45,代码来源:Benchmark.java

示例6: validateParameterConfiguration

import edacc.parameterspace.ParameterConfiguration; //导入方法依赖的package包/类
public boolean validateParameterConfiguration(ParameterConfiguration config) {
       Set<OrNode> assigned_or_nodes = new HashSet<OrNode>();
       Set<AndNode> assigned_and_nodes = new HashSet<AndNode>();
       Set<Parameter> params = new HashSet<Parameter>(config.getParameter_instances().keySet());

       /*for (Parameter p: params) {
           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);
               }
           }
       }
       
       boolean valid = true; 
       for (Node n: adjacentNodes(startNode)) {
           if (!assigned_or_nodes.contains(n)) {
               System.err.println("Mandatory parameter " + n.getParameter().getName() + " has no value.");
               valid = false;;
           }
       }*/
       
       Set<Parameter> checkedParameters = new HashSet<Parameter>();
       
       assigned_and_nodes.add(startNode);
       Queue<Node> q = new LinkedList<Node>();
       q.addAll(adjacentNodes(startNode));
       while (!q.isEmpty()) {
           Node n = q.remove();
           checkedParameters.add(n.getParameter());
           
           if (incomingEdgesDone(n, assigned_and_nodes)) {
               boolean parameterSet = false;
               for (Node subNode: adjacentNodes(n)) {
                   AndNode subAndNode = (AndNode)subNode;
                   if (subAndNode.getDomain().contains(config.getParameterValue(subAndNode.getParameter()))) {
                       assigned_and_nodes.add(subAndNode);
                       q.addAll(adjacentNodes(subAndNode));
                       parameterSet = true;
                   }
               }
               if (!parameterSet) {
                   System.err.println("Parameter " + n.getParameter().getName() + " missing value.");
                   return false;
               }
           }
       }
       
       for (Parameter p: config.getParameter_instances().keySet()) {
           if (!checkedParameters.contains(p) && config.getParameterValue(p) != null && config.getParameterValue(p) != FlagDomain.FLAGS.OFF) {
               System.err.println("Parameter " + p.getName() + " is set but shouldn't be. Value: " + config.getParameterValue(p));
               return false;
           }
       }
       
       
       
       /*assigned_and_nodes.add(startNode);
       
       for (OrNode n: assigned_or_nodes) {
           if (!incomingEdgesDone(n, assigned_and_nodes)) {
               System.err.println("Parameter " + n.getParameter().getName() + " is conditional but parent has wrong value.");
               valid = false;
           }
           
       }*/

       return true;
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:71,代码来源:ParameterGraph.java

示例7: getCanonicalName

import edacc.parameterspace.ParameterConfiguration; //导入方法依赖的package包/类
public synchronized String getCanonicalName(int idExperiment, ParameterConfiguration config) throws Exception {
    ConfigurationScenario cs = getConfigScenario(idExperiment);
    StringBuilder name = new StringBuilder();
    List<ConfigurationScenarioParameter> params = cs.getParameters();
    // sort parameters in ascending order of their name
    Collections.sort(params);
    for (ConfigurationScenarioParameter param : params) {
        if (isMagicSolverParameter(param.getParameter().getName()))
            continue;
        if (param.isConfigurable()) {
            edacc.parameterspace.Parameter config_param = null;
            for (edacc.parameterspace.Parameter p : config.getParameter_instances().keySet()) {
                if (p.getName().equals(param.getParameter().getName())) {
                    config_param = p;
                    break;
                }
            }
            if (config_param == null) {
                continue;
            }
            if (config.getParameterValue(config_param) == null) continue;

            if (OptionalDomain.OPTIONS.NOT_SPECIFIED.equals(config.getParameterValue(config_param)))
                continue;
            else if (FlagDomain.FLAGS.ON.equals(config.getParameterValue(config_param))) {
                if (param.getParameter().getPrefix() != null) name.append(param.getParameter().getPrefix());
                if (param != params.get(params.size() - 1))
                    name.append(" ");
            } else {
                if (param.getParameter().getPrefix() != null) name.append(param.getParameter().getPrefix());
                if (param.getParameter().getSpace())
                    name.append(" ");
                name.append(config.getValueRepresentation(config.getParameterValue(config_param)));
                if (param != params.get(params.size() - 1))
                    name.append(" ");
            }
        }

    }
    return name.toString();
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:42,代码来源:APIImpl.java

示例8: createParameterInstancesList

import edacc.parameterspace.ParameterConfiguration; //导入方法依赖的package包/类
private synchronized List<ParameterInstance> createParameterInstancesList(int idExperiment, SolverConfiguration solver_config, ParameterConfiguration config) throws Exception {
    ConfigurationScenario cs = getConfigScenario(idExperiment);
    List<ParameterInstance> parameter_instances = new ArrayList<ParameterInstance>();
    for (ConfigurationScenarioParameter param : cs.getParameters()) {
        ParameterInstance pi = new ParameterInstance();
        if (isMagicSolverParameter(param.getParameter().getName())) {
            pi.setSolverConfiguration(solver_config);
            pi.setValue("");
            pi.setParameter_id(param.getParameter().getId());
            
        } else if (!param.isConfigurable()) {
            if (param.getParameter().getHasValue()) {
                pi.setSolverConfiguration(solver_config);
                pi.setValue(param.getFixedValue());
                pi.setParameter_id(param.getParameter().getId());
            } else { // flag
                pi.setSolverConfiguration(solver_config);
                pi.setValue("");
                pi.setParameter_id(param.getParameter().getId());
            }
        } else if (param.isConfigurable()) {
            edacc.parameterspace.Parameter config_param = null;
            for (edacc.parameterspace.Parameter p : config.getParameter_instances().keySet()) {
                if (p.getName().equals(param.getParameter().getName())) {
                    config_param = p;
                    break;
                }
            }
            if (config_param == null) {
                continue;
            }
            if (config.getParameterValue(config_param) == null) continue;

            if (OptionalDomain.OPTIONS.NOT_SPECIFIED.equals(config.getParameterValue(config_param)))
                continue;
            else if (FlagDomain.FLAGS.OFF.equals(config.getParameterValue(config_param)))
                continue;
            else {
                pi.setSolverConfiguration(solver_config);
                pi.setValue(config.getValueRepresentation(config.getParameterValue(config_param)));
                pi.setParameter_id(param.getParameter().getId());
            }
        }
        parameter_instances.add(pi);
    }
    return parameter_instances;
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:48,代码来源:APIImpl.java


注:本文中的edacc.parameterspace.ParameterConfiguration.getParameterValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。