本文整理汇总了Java中ec.util.Parameter类的典型用法代码示例。如果您正苦于以下问题:Java Parameter类的具体用法?Java Parameter怎么用?Java Parameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Parameter类属于ec.util包,在下文中一共展示了Parameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNumGensField
import ec.util.Parameter; //导入依赖的package包/类
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
JTextField getNumGensField()
{
if (numGensField == null)
{
numGensField = new JTextField();
numGensField.addKeyListener(new java.awt.event.KeyAdapter()
{
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ENTER)
{
console.parameters.set(new Parameter(EvolutionState.P_GENERATIONS), ((JTextField)e.getSource()).getText());
}
else if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
{
((JTextField)e.getSource()).setText(console.parameters.getString(new Parameter(EvolutionState.P_GENERATIONS),null));
}
}
});
}
return numGensField;
}
示例2: getQuitOnRunCompleteCheckbox
import ec.util.Parameter; //导入依赖的package包/类
/**
* This method initializes jCheckBox
*
* @return javax.swing.JCheckBox
*/
JCheckBox getQuitOnRunCompleteCheckbox()
{
if (quitOnRunCompleteCheckbox == null)
{
quitOnRunCompleteCheckbox = new JCheckBox();
quitOnRunCompleteCheckbox.setText("Quit on Run Complete");
quitOnRunCompleteCheckbox.addItemListener(new java.awt.event.ItemListener()
{
public void itemStateChanged(java.awt.event.ItemEvent e)
{
console.parameters.set(new Parameter(EvolutionState.P_QUITONRUNCOMPLETE),
"" + ((JCheckBox)e.getSource()).isSelected());
}
});
}
return quitOnRunCompleteCheckbox;
}
示例3: getEvalThreadsField
import ec.util.Parameter; //导入依赖的package包/类
/**
* This method initializes jTextField2
*
* @return javax.swing.JTextField
*/
JTextField getEvalThreadsField()
{
if (evalThreadsField == null)
{
evalThreadsField = new JTextField();
evalThreadsField.addKeyListener(new java.awt.event.KeyAdapter()
{
public void keyPressed(java.awt.event.KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ENTER)
{
console.parameters.set(new Parameter(Evolve.P_EVALTHREADS), ((JTextField)e.getSource()).getText());
resizeSeedTable();
}
else if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
{
((JTextField)e.getSource()).setText(console.parameters.getString(new Parameter(Evolve.P_EVALTHREADS),null));
}
}
});
}
return evalThreadsField;
}
示例4: getBreedThreadsField
import ec.util.Parameter; //导入依赖的package包/类
/**
* This method initializes jTextField3
*
* @return javax.swing.JTextField
*/
JTextField getBreedThreadsField()
{
if (breedThreadsField == null)
{
breedThreadsField = new JTextField();
breedThreadsField.addKeyListener(new java.awt.event.KeyAdapter()
{
public void keyPressed(java.awt.event.KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ENTER)
{
console.parameters.set(new Parameter(Evolve.P_BREEDTHREADS), ((JTextField)e.getSource()).getText());
resizeSeedTable();
}
else if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
{
((JTextField)e.getSource()).setText(console.parameters.getString(new Parameter(Evolve.P_BREEDTHREADS),null));
}
}
});
}
return breedThreadsField;
}
示例5: getCheckpointCheckBox
import ec.util.Parameter; //导入依赖的package包/类
/**
* This method initializes jCheckBox10
*
* @return javax.swing.JCheckBox
*/
JCheckBox getCheckpointCheckBox()
{
if (checkpointCheckBox == null)
{
checkpointCheckBox = new JCheckBox();
checkpointCheckBox.setText("Checkpoint");
checkpointCheckBox.addItemListener(new java.awt.event.ItemListener()
{
public void itemStateChanged(java.awt.event.ItemEvent e)
{
if (e.getStateChange() == ItemEvent.SELECTED)
{
setEnabled(checkpointPanel, true);
}
else
{
setEnabled(checkpointPanel, false);
}
console.parameters.set(new Parameter(EvolutionState.P_CHECKPOINT),"" + ((JCheckBox)e.getSource()).isSelected());
}
});
}
return checkpointCheckBox;
}
示例6: getCheckpointModuloField
import ec.util.Parameter; //导入依赖的package包/类
/**
* This method initializes jTextField8
*
* @return javax.swing.JTextField
*/
JTextField getCheckpointModuloField()
{
if (checkpointModuloField == null)
{
checkpointModuloField = new JTextField();
checkpointModuloField.setPreferredSize(new java.awt.Dimension(35,20));
checkpointModuloField.setEnabled(false);
checkpointModuloField.addKeyListener(new java.awt.event.KeyAdapter()
{
public void keyPressed(java.awt.event.KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ENTER)
{
console.parameters.set(new Parameter(EvolutionState.P_CHECKPOINTMODULO), ((JTextField)e.getSource()).getText());
}
else if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
{
((JTextField)e.getSource()).setText(console.parameters.getString(new Parameter(EvolutionState.P_CHECKPOINTMODULO),null));
}
}
});
}
return checkpointModuloField;
}
示例7: getPrefixField
import ec.util.Parameter; //导入依赖的package包/类
/**
* This method initializes jTextField9
*
* @return javax.swing.JTextField
*/
JTextField getPrefixField()
{
if (prefixField == null)
{
prefixField = new JTextField();
prefixField.setEnabled(false);
prefixField.addKeyListener(new java.awt.event.KeyAdapter()
{
public void keyPressed(java.awt.event.KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ENTER)
{
console.parameters.set(new Parameter(EvolutionState.P_CHECKPOINTPREFIX), ((JTextField)e.getSource()).getText());
}
else if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
{
((JTextField)e.getSource()).setText(console.parameters.getString(new Parameter(EvolutionState.P_CHECKPOINTPREFIX),null));
}
}
});
}
return prefixField;
}
示例8: getJobFilePrefixField
import ec.util.Parameter; //导入依赖的package包/类
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
JTextField getJobFilePrefixField()
{
if (jobFilePrefixField == null)
{
jobFilePrefixField = new JTextField();
jobFilePrefixField.addKeyListener(new java.awt.event.KeyAdapter()
{
public void keyPressed(java.awt.event.KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ENTER)
{
console.parameters.set(new Parameter(P_JOBFILEPREFIX), ((JTextField)e.getSource()).getText());
}
else if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
{
((JTextField)e.getSource()).setText(console.parameters.getStringWithDefault(new Parameter(P_JOBFILEPREFIX),null,""));
}
}
});
}
return jobFilePrefixField;
}
示例9: setup
import ec.util.Parameter; //导入依赖的package包/类
public void setup(final EvolutionState state, final Parameter base)
{
super.setup(state,base);
// double check that we have valid evaluators and breeders and exchangers
if (!(breeder instanceof SteadyStateBreeder))
state.output.error("You've chosen to use Steady-State Evolution, but your breeder is not of the class SteadyStateBreeder.",base);
if (!(evaluator instanceof SteadyStateEvaluator))
state.output.error("You've chosen to use Steady-State Evolution, but your evaluator is not of the class SteadyStateEvaluator.",base);
if (!(exchanger instanceof SteadyStateExchangerForm))
state.output.error("You've chosen to use Steady-State Evolution, but your exchanger does not implement the SteadyStateExchangerForm.",base);
checkStatistics(state, statistics, base);
numEvaluations = parameters.getLong(new Parameter(P_NUMEVALUATIONS),null,1);
if (numEvaluations == 0)
output.message("Number of evaluations not defined; using number of generations");
}
示例10: setup
import ec.util.Parameter; //导入依赖的package包/类
/** Sets up the RuleConstraints and RuleSetConstraints cliques. */
public void setup(final EvolutionState state, final Parameter base)
{
super.setup(state,base);
ruleConstraintRepository = new Hashtable();
ruleConstraints = new RuleConstraints[SIZE_OF_BYTE];
numRuleConstraints = 0;
ruleSetConstraintRepository = new Hashtable();
ruleSetConstraints = new RuleSetConstraints[SIZE_OF_BYTE];
numRuleSetConstraints = 0;
// Now let's load our constraints and function sets also.
// This is done in a very specific order, don't change it or things
// will break.
setupConstraints(
state, RuleDefaults.base().push( P_RULECONSTRAINTS ) );
setupRuleSetConstraints(
state, RuleDefaults.base().push( P_RULESETCONSTRAINTS ) );
}
示例11: setupRuleSetConstraints
import ec.util.Parameter; //导入依赖的package包/类
public void setupRuleSetConstraints(final EvolutionState state,
final Parameter base)
{
state.output.message("Processing Ruleset Constraints");
// How many RuleSetConstraints do we have?
int x = state.parameters.getInt(base.push(P_SIZE),null,1);
if (x<=0)
state.output.fatal("The number of RuleSetConstraints must be at least 1.",base.push(P_SIZE));
// Load our RuleSetConstraints
for (int y=0;y<x;y++)
{
RuleSetConstraints c;
// Figure the RuleSetConstraints class
if (state.parameters.exists(base.push(""+y), null))
c = (RuleSetConstraints)(state.parameters.getInstanceForParameterEq(
base.push(""+y),null,RuleSetConstraints.class));
else
{
state.output.message("No RuleSetConstraints specified, assuming the default class: ec.gp.RuleSetConstraints for " + base.push(""+y));
c = new RuleSetConstraints();
}
c.setup(state,base.push(""+y));
ruleSetConstraints[y] = c;
}
}
示例12: setup
import ec.util.Parameter; //导入依赖的package包/类
public void setup(final EvolutionState state, final Parameter base)
{
Parameter p = new Parameter(Initializer.P_POP).push(Population.P_SIZE);
int size = state.parameters.getInt(p,null,1); // if size is wrong, we'll let Population complain about it -- for us, we'll just make 0-sized arrays and drop out.
elite = new int[size];
reevaluateElites = new boolean[size];
for(int x=0;x<size;x++)
{
elite[x] = state.parameters.getIntWithDefault(base.push(P_ELITE).push(""+x),null,0);
if (elite[x]<0) state.output.error("The number of elites for subpopulation " + x + " must be >= 0",base.push(P_ELITE).push(""+x));
reevaluateElites[x] = state.parameters.getBoolean(base.push(P_REEVALUATE_ELITES).push(""+x),null,false);
}
state.output.exitIfErrors();
}
示例13: setup
import ec.util.Parameter; //导入依赖的package包/类
public void setup(final EvolutionState state, final Parameter base)
{
super.setup(state,base);
/**
* TODO Move setup methods to the corresponding GP type.
*/
// This is a good place to set up the types. We use our own base off the
// default GP base. This MUST be done before loading constraints.
setupTypes(state,GPDefaults.base().push(P_TYPE));
// Now let's load our constraints and function sets also.
// This is done in a very specific order, don't change it or things
// will break.
setupNodeConstraints(
state,GPDefaults.base().push(P_NODECONSTRAINTS));
setupFunctionSets(
state,GPDefaults.base().push(P_FUNCTIONSETS));
setupTreeConstraints(
state,GPDefaults.base().push(P_TREECONSTRAINTS));
}
示例14: setup
import ec.util.Parameter; //导入依赖的package包/类
/**
* TODO Method description
*
* @param state
* @param base
* @see edu.snu.leader.util.ParseableStatistics#setup(ec.EvolutionState, ec.util.Parameter)
*/
@Override
public void setup( EvolutionState state, Parameter base )
{
_LOG.trace( "Entering setup( state, base )" );
// Call the superclass implementation
super.setup( state, base );
// Get the number of objectives
Validate.isTrue( state.parameters.exists(
base.push( P_NUM_OBJECTIVES ), null ),
"Number of fitness objectives is required " );
_numObjectives = state.parameters.getInt(
base.push( P_NUM_OBJECTIVES ),
null );
_LOG.info( "Using _numObjectives=[" + _numObjectives + "]" );
// We don't need a "best found" since we have a pareto front
_bestFound = new Individual[0];
_LOG.trace( "Leaving setup( state, base )" );
}
示例15: with
import ec.util.Parameter; //导入依赖的package包/类
/**
* @param keys the parameter key
* @param value the parameter value
* @return this {@link AbstractParamDB}
*/
@SuppressWarnings("unchecked")
public THIS with(final List<String> keys, final Object value)
{
if (keys == null || keys.size() == 0)
throw new IllegalArgumentException("keys can't be empty");
Parameter param = new Parameter(keys.get(0));
for (int i = 1; i < keys.size(); i++)
param = param.push(keys.get(i));
set(param, value instanceof Class ? ((Class<?>) value).getName()
: value.toString());
return (THIS) this;
}