Exemplo n.º 1
0
 /**
  * Adds a new int parameter to be altered for the model being tuned.
  *
  * @param param the model parameter
  * @param initialSearchValues the values to try for the specified parameter
  */
 public void addParameter(IntParameter param, int... initialSearchValues) {
   searchParams.add(param);
   DoubleList dl = new DoubleList(initialSearchValues.length);
   for (double d : initialSearchValues) dl.add(d);
   Arrays.sort(dl.getBackingArray()); // convience, only really needed if param is warm
   if (param.isWarmParameter() && !param.preferredLowToHigh())
     Collections.reverse(dl); // put it in the prefered order
   if (param.isWarmParameter()) // put it at the front!
   searchValues.add(0, dl);
   else searchValues.add(dl);
 }
Exemplo n.º 2
0
 /**
  * Sets the parameters according to the given array
  *
  * @param setTo the index corresponds to the parameters, and the value which parameter value to
  *     use.
  */
 private void setParameters(int[] setTo) {
   for (int i = 0; i < setTo.length; i++) {
     Parameter param = searchParams.get(i);
     if (param instanceof DoubleParameter)
       ((DoubleParameter) param).setValue(searchValues.get(i).get(setTo[i]));
     else if (param instanceof IntParameter)
       ((IntParameter) param).setValue(searchValues.get(i).get(setTo[i]).intValue());
   }
 }