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


Java ParameterConfiguration类代码示例

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


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

示例1: testEqualsObject

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
@Test
public void testEqualsObject() throws Exception {
	APIImpl api = new APIImpl();
	ParameterGraph pspace = api.loadParameterGraphFromFile("src/edacc/parameterspace/test/complex.xml");
	ParameterConfiguration config = new ParameterConfiguration(pspace.getParameterSet());
	config.setParameterValue("c1", 5);
	config.setParameterValue("ps", 0.1);
	config.setParameterValue("flag", FlagDomain.FLAGS.OFF);
	assertTrue("c1: 5 flag: OFF ps: 0.1 ".equals(config.toString()));
	
	ParameterConfiguration config2 = new ParameterConfiguration(pspace.getParameterSet());
	config2.setParameterValue("c1", 5);
	config2.setParameterValue("ps", 0.1);
	config2.unsetParameter("flag"); // set flag to null, should be equal to a configuration with flag = FlagDomain.FLAGS.OFF
	
	assertTrue(config.equals(config2));
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:18,代码来源:ParameterConfigurationTest.java

示例2: testCrossover

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
@Test
public void testCrossover() 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.crossover(config1, config2, rng);
	
	for (Parameter p: pspace.parameters) {
		Object p_val1 = cross.getFirst().getParameterValue(p);
		Object p_val2 = cross.getSecond().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,代码行数:27,代码来源:ParameterGraphTest.java

示例3: generateNewSC

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
@Override
public List<SolverConfiguration> generateNewSC(int num) throws Exception {
	List<SolverConfiguration> bestSCs = pacc.racing.getBestSolverConfigurations(1);
	SolverConfiguration currentBestSC = (bestSCs.size() > 0 ? bestSCs.get(0) : firstSCs.get(0));
	
	List<SolverConfiguration> res = new ArrayList<SolverConfiguration>();
	ParameterConfiguration bestSCP = currentBestSC.getParameterConfiguration();
	for (int i = 0; i < num; i++) {
		//ParameterConfiguration paramconfig = api.loadParameterGraphFromDB(idExperiment).getRandomConfiguration(rng);
		ParameterConfiguration paramconfig = new ParameterConfiguration(bestSCP);
		api.loadParameterGraphFromDB(parameters.getIdExperiment()).mutateParameterConfiguration(rng, paramconfig, rng.nextFloat(), 0.8f);
		int idSolverConfig = api.createSolverConfig(parameters.getIdExperiment(), paramconfig, api.getCanonicalName(parameters.getIdExperiment(), paramconfig));
		res.add(new SolverConfiguration(idSolverConfig, api.getParameterConfiguration(parameters.getIdExperiment(), idSolverConfig), parameters.getStatistics()));
	}
	return res;
}
 
开发者ID:EDACC,项目名称:edacc_aac,代码行数:17,代码来源:MB.java

示例4: ILSNeighbourhood

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
public ILSNeighbourhood(SolverConfiguration starter, ILS ils){
    this.starter = starter;
    this.ils = ils;
    pendingConfigs = new LinkedList<ParameterConfiguration>();
    runningConfigs = new LinkedList<SolverConfiguration>();
    completedConfigs = new LinkedList<SolverConfiguration>();
    currentBest = null;
    
    List<ParameterConfiguration> tmpConfigList;
    tmpConfigList = ils.getNeighbourhood(starter.getParameterConfiguration(), 1);
    if(debug)
        ils.debugLog("New neighbourhood has "+tmpConfigList.size()+" configs.");
    //remove configs that have previously been evaluated
    for(ParameterConfiguration p: tmpConfigList){
        if(!ils.isConfigAlreadyEvaluated(p))
            pendingConfigs.add(p);
    }
    if(debug)
        ils.debugLog(pendingConfigs.size()+" configs left after checking for duplicates!");
    
}
 
开发者ID:EDACC,项目名称:edacc_aac,代码行数:22,代码来源:ILSNeighbourhood.java

示例5: nextStage

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
private boolean nextStage(){
    if(stage == 3)
        return false;
    int quality = ils.assessQuality(starter);
    if(quality>stage){
        stage++;
        List<ParameterConfiguration> neighbours = 
                ils.getNeighbourhood(starter.getParameterConfiguration(), stage);
        List<ParameterConfiguration> retain = new LinkedList<ParameterConfiguration>();
        for(ParameterConfiguration p : neighbours){
            if(!ils.isConfigAlreadyEvaluated(p) && !pendingConfigs.contains(p))
                pendingConfigs.add(p);
        }
        return true;
    }
    return false;
}
 
开发者ID:EDACC,项目名称:edacc_aac,代码行数:18,代码来源:ILSNeighbourhood.java

示例6: 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

示例7: startSecondaryNeighbourhood

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
private void startSecondaryNeighbourhood(SolverConfiguration starter) throws Exception{
    numberOfLocalMinimums++;
    if(secondaryNeighbourhood != null){
        secondaryNeighbourhood.killHard();
        activeNeighbourhoods.add(secondaryNeighbourhood);
        secondaryNeighbourhood = null;
    }
    ParameterConfiguration p;
    if(rng.nextDouble()<restartProbability){
        p = paramGraph.getRandomConfiguration(rng);
        aac.log("ILS: Possible local minimum: Trying to escape with random configuration!"); 
    }else{
        p = starter.getParameterConfiguration();
        for(int i=0; i<pertubationSteps; i++){
            p = paramGraph.getRandomNeighbour(p, rng);
        }
        aac.log("ILS: Possible local minimum: Trying to escape with "+pertubationSteps+" pertubation steps"); 
    }
    secondaryNeighbourhood = new ILSNeighbourhood(createSolverConfig(p), this);
    if(debug)
        aac.log("ILS_Debug: new secondary neighbourhood has "+secondaryNeighbourhood.getNumberOfAvailableConfigs(0)+" configs available!");
}
 
开发者ID:EDACC,项目名称:edacc_aac,代码行数:23,代码来源:ILS.java

示例8: getThetaPredictions

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
private ThetaPrediction[] getThetaPredictions(List<ParameterConfiguration> configs) {
    double[][] thetas = new double[configs.size()][];
    ThetaPrediction[] thetaPred = new ThetaPrediction[configs.size()];
    int ix = 0;
    for (ParameterConfiguration config: configs) {
        thetas[ix] = paramConfigToTuple(config);
        thetaPred[ix] = new ThetaPrediction();
        thetaPred[ix].paramConfig = config;
        thetaPred[ix].theta = thetas[ix];
        ix++;
    }
    double[][] preds = model.predict(thetas);
    for (int i = 0; i < configs.size(); i++) {
        thetaPred[i].mu = preds[i][0];
        thetaPred[i].sigma = Math.sqrt(preds[i][1]);
    }
    return thetaPred;
}
 
开发者ID:EDACC,项目名称:edacc_aac,代码行数:19,代码来源:SMBO.java

示例9: generateNewSC

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
@Override
public List<SolverConfiguration> generateNewSC(int num) throws Exception {
    List<SolverConfiguration> solverConfigs = new LinkedList<SolverConfiguration>();
    if (currentSequencePosition + 1 > maxSamples) return solverConfigs;
    
    if (pacc.racing instanceof FRace || pacc.racing instanceof SMFRace) {
        // FRace and SMFRace don't automatically use the old best configurations
        solverConfigs.addAll(pacc.racing.getBestSolverConfigurations(num));
    }
    
    for (int i = 0; i < num - solverConfigs.size(); i++) {
        if (currentSequencePosition + 1 > maxSamples) break;
        ParameterConfiguration pc = mapRealTupleToParameters(sequenceValues[currentSequencePosition++]);
        int idSC = api.createSolverConfig(parameters.getIdExperiment(), pc, "SN: " + currentSequencePosition);
        solverConfigs.add(new SolverConfiguration(idSC, pc, parameters.getStatistics()));
    }
    return solverConfigs;
}
 
开发者ID:EDACC,项目名称:edacc_aac,代码行数:19,代码来源:RandomSequenceSampling.java

示例10: main

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
public static void main(String ... args) throws Exception {
    Random rng = new Random();
	APIImpl api = new APIImpl();
	
	api.connect("edacc3.informatik.uni-ulm.de", 3306, "x", "y", "z");
	
	
	ParameterGraph pspace = api.loadParameterGraphFromDB(398);
	/*List<ParameterConfiguration> cfgs = new ArrayList<ParameterConfiguration>();
	for (Integer id: api.getSolverConfigurations(398)) {
		ParameterConfiguration cfg = api.getParameterConfiguration(398, id);
		cfgs.add(cfg);
		if (!pspace.validateParameterConfiguration(cfg)) {
		System.out.println(id + " " + cfg);
		}
	}*/
	
	
	for (int i = 0; i < 10000; i++) {
		ParameterConfiguration c = pspace.getRandomConfiguration(rng);
		c = pspace.getGaussianNeighbourhood(c, rng, 1.0f, 100, true).get(0);
		if (!pspace.validateParameterConfiguration(c)) {
			System.err.println("Generated invalid random config " + c);
			System.err.flush();
		}
		System.out.println(c);
	}


}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:31,代码来源:APITest.java

示例11: testGetConstrainedNeighbourhood

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
@Test
public void testGetConstrainedNeighbourhood() throws Exception {
	API api = new APIImpl();
	ParameterGraph pspace = api.loadParameterGraphFromFile("src/edacc/parameterspace/test/sparrow_parameterspace.xml");
	ParameterConfiguration config = new ParameterConfiguration(pspace.getParameterSet());
	config.setParameterValue("ps", 0.2);
	config.setParameterValue("c1", 10);
	config.setParameterValue("c2", 20);
	config.setParameterValue("c3", 20);
	
	List<ParameterConfiguration> nbh = pspace.getConstrainedNeighbourhood(config);
	
	ParameterConfiguration neighbour1 = new ParameterConfiguration(config);
	neighbour1.setParameterValue("c1", 11);
	
	ParameterConfiguration neighbour2 = new ParameterConfiguration(config);
	neighbour2.setParameterValue("c1", 50);
	
	ParameterConfiguration neighbour3 = new ParameterConfiguration(config);
	neighbour3.setParameterValue("ps", 0.5);
	
	ParameterConfiguration nonneighbour1 = new ParameterConfiguration(config);
	nonneighbour1.setParameterValue("c1", 11);
	nonneighbour1.setParameterValue("c2", 19);
	
	assertTrue(nbh.contains(neighbour1));
	assertTrue(nbh.contains(neighbour2));
	assertTrue(nbh.contains(neighbour3));
	assertFalse(nbh.contains(nonneighbour1));

	assertTrue(nbh.size() == 100 + 51 + 51 + 21 - 4); // 100 ps, 51 c1, 51 c2, 21 c3 values, minus 4 fixed values from config
	assertFalse(nbh.contains(config));
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:34,代码来源:ParameterGraphTest.java

示例12: testGetFullNeighbourhood

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
@Test
public void testGetFullNeighbourhood() throws Exception {
    API api = new APIImpl();
	ParameterGraph pspace = api.loadParameterGraphFromFile("src/edacc/parameterspace/test/complex.xml");
	ParameterConfiguration config = new ParameterConfiguration(pspace.getParameterSet());
	config.setParameterValue("c1", 5);
	config.setParameterValue("ps", 0.1);
	config.setParameterValue("flag", FlagDomain.FLAGS.ON);
	config.setParameterValue("method", "hybrid");
	config.setParameterValue("cat", "1");
	assertTrue("c1: 5 cat: 1 method: hybrid flag: ON ps: 0.1 ".equals(config.toString()));
	
	List<ParameterConfiguration> nbh = pspace.getNeighbourhood(config);
	
	ParameterConfiguration nb1 = new ParameterConfiguration(config);		
	nb1.setParameterValue("method", "atom");
	assertTrue(nbh.contains(nb1));
	
	ParameterConfiguration nb2 = new ParameterConfiguration(config);
	nb2.setParameterValue("flag", FlagDomain.FLAGS.OFF);
	assertFalse(nbh.contains(nb2)); // flag -> off should lead to method and cat being removed
	nb2.unsetParameter("cat");
	nb2.unsetParameter("method");
	assertTrue(nbh.contains(nb2));
	
	ParameterConfiguration nb3 = new ParameterConfiguration(config);
	nb3.setParameterValue("c1", 6);
	assertTrue(nbh.contains(nb3));
	nb3.setParameterValue("c1", 5); // same config
	assertFalse(nbh.contains(nb3));
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:32,代码来源:ParameterGraphTest.java

示例13: testGetRandomNeighbour

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
@Test
public void testGetRandomNeighbour() throws Exception {
	Random rng = new MersenneTwister();
	API api = new APIImpl();
	ParameterGraph pspace = api.loadParameterGraphFromFile("src/edacc/parameterspace/test/sparrow_parameterspace.xml");
	ParameterConfiguration config = new ParameterConfiguration(pspace.getParameterSet());
	config.setParameterValue("ps", 0.2);
	config.setParameterValue("c1", 1);
	config.setParameterValue("c2", 2);
	config.setParameterValue("c3", 15);
	
	List<ParameterConfiguration> nbh = pspace.getConstrainedNeighbourhood(config);
	for (int i = 0; i < 100; i++) assertTrue(nbh.contains(pspace.getRandomNeighbour(config, rng)));
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:15,代码来源:ParameterGraphTest.java

示例14: 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

示例15: testValidateParameterConfiguration

import edacc.parameterspace.ParameterConfiguration; //导入依赖的package包/类
@Test
public void testValidateParameterConfiguration() throws Exception {
       API api = new APIImpl();
       ParameterGraph pspace = api.loadParameterGraphFromFile("src/edacc/parameterspace/test/complex.xml");
       ParameterConfiguration config = new ParameterConfiguration(pspace.getParameterSet());
       config.setParameterValue("c1", 5);
       config.setParameterValue("ps", 0.1);
       config.setParameterValue("flag", FlagDomain.FLAGS.ON);
       config.setParameterValue("method", "hybrid");
       config.setParameterValue("cat", "1");
       
       assertTrue(pspace.validateParameterConfiguration(config));
       
       List<ParameterConfiguration> nbh = pspace.getNeighbourhood(config);
       
       ParameterConfiguration nb1 = new ParameterConfiguration(config);        
       nb1.setParameterValue("method", "atom");
       assertTrue(nbh.contains(nb1));
       assertTrue(pspace.validateParameterConfiguration(nb1));
       
       ParameterConfiguration nb2 = new ParameterConfiguration(config);
       nb2.setParameterValue("flag", FlagDomain.FLAGS.OFF);
       assertFalse(nbh.contains(nb2)); // flag -> off should lead to method and cat being removed
       assertFalse(pspace.validateParameterConfiguration(nb2));
       nb2.unsetParameter("cat");
       nb2.unsetParameter("method");
       assertTrue(nbh.contains(nb2));
       assertTrue(pspace.validateParameterConfiguration(nb2));
       
       ParameterConfiguration nb3 = new ParameterConfiguration(config);
       nb3.setParameterValue("c1", 6);
       assertTrue(nbh.contains(nb3));
       nb3.setParameterValue("c1", 5); // same config
       assertFalse(nbh.contains(nb3));
       assertTrue(pspace.validateParameterConfiguration(nb3));
}
 
开发者ID:EDACC,项目名称:edacc_api,代码行数:37,代码来源:ParameterGraphTest.java


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