Search in sources :

Example 1 with ParameterSet

use of gov.sandia.n2a.parms.ParameterSet in project n2a by frothga.

the class ParameterSetList method createTestList.

public static ParameterSetList createTestList() {
    ParameterSet s1 = new ParameterSet();
    s1.put("level", 0);
    s1.put("height", 100);
    ParameterSet s2 = new ParameterSet();
    s2.put("level", 1);
    s2.put("height", 200);
    ParameterSet s3 = new ParameterSet();
    s3.put("level", 2);
    s3.put("height", 300);
    ParameterSetList list = new ParameterSetList();
    list.add(s1);
    list.add(s2);
    list.add(s3);
    return list;
}
Also used : ParameterSet(gov.sandia.n2a.parms.ParameterSet)

Example 2 with ParameterSet

use of gov.sandia.n2a.parms.ParameterSet in project n2a by frothga.

the class ParameterSetList method transform.

// ////////
// MISC //
// ////////
public ParameterSetMap transform() {
    ParameterSetMap map = new ParameterSetMap();
    for (ParameterSet set : this) {
        for (Object paramKey : set.keySet()) {
            List<Object> data = map.get(paramKey, new ArrayList<Object>(size()));
            data.add(set.get(paramKey));
        }
    }
    return map;
}
Also used : ParameterSet(gov.sandia.n2a.parms.ParameterSet)

Example 3 with ParameterSet

use of gov.sandia.n2a.parms.ParameterSet in project n2a by frothga.

the class ParameterSpecGroupSet method printParameterSets.

public void printParameterSets(boolean includeDVGroup) {
    ParameterSetList sets = generateAllSetsFromSpecs(includeDVGroup);
    System.out.println(sets.size() + " Parameter Set" + StringUtil.s(sets.size()) + ":");
    for (ParameterSet set : sets) {
        System.out.println(set);
    }
}
Also used : ParameterSet(gov.sandia.n2a.parms.ParameterSet) ParameterSetList(gov.sandia.umf.platform.ensemble.params.ParameterSetList)

Example 4 with ParameterSet

use of gov.sandia.n2a.parms.ParameterSet in project n2a by frothga.

the class ParameterSpecGroupSet method generateAllSetsFromSpecs.

public ParameterSetList generateAllSetsFromSpecs(boolean includeDVGroup) throws ParameterSpecGroupSetValidationException {
    validate();
    Set<Object> skipDVGroupParams = findSkipDVGroupParams();
    ParameterSetList sets = new ParameterSetList();
    // does return "zero" runs.
    if (size() == 1 && get(0) == defaultValueGroup && !includeDVGroup) {
        sets.add(new ParameterSet());
        return sets;
    }
    // Make sure that the default value group is applied at the end for
    // this process, just to have a nicely-sorted final parameter set,
    // and use the sorted copy of this group set
    // to access group information from this point forward in
    // the method.  Wouldn't need this sorted copy if code
    // were refactored to not have the DV group as part of the
    // actual group list.
    ParameterSpecGroupSet sortedCopy = new ParameterSpecGroupSet(this);
    sortedCopy.setDefaultValueGroup(defaultValueGroup, sortedCopy.size());
    // Get the counts of each group.
    Integer[] groupRunCounts = sortedCopy.getGroupRunCounts(includeDVGroup);
    for (int[] idxs : new CombinationsIterator(groupRunCounts)) {
        ParameterSet set = new ParameterSet();
        for (int i = 0, g = 0; i < idxs.length; i++) {
            ParameterSpecGroup group = sortedCopy.get(g++);
            // Ignore the default values if desired.
            if (!includeDVGroup && group == defaultValueGroup) {
                // Just leap past this one, move to next.
                group = sortedCopy.get(g++);
            }
            int idx = idxs[i];
            addGroupParamsToParamSet(set, group, idx, skipDVGroupParams);
        }
        // if(includeDVGroup && defaultValueGroup != null) { // If refactored to have DV group separate reference.
        // addGroupParamsToParamSet(skipDVGroupParams, set, idx, defaultValueGroup);
        // }
        sets.add(set);
    }
    return sets;
}
Also used : ParameterSet(gov.sandia.n2a.parms.ParameterSet) ParameterSetList(gov.sandia.umf.platform.ensemble.params.ParameterSetList) ConstantParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.ConstantParameterSpecGroup) LatinHypercubeParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.LatinHypercubeParameterSpecGroup) MonteCarloParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.MonteCarloParameterSpecGroup) ParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup)

Aggregations

ParameterSet (gov.sandia.n2a.parms.ParameterSet)4 ParameterSetList (gov.sandia.umf.platform.ensemble.params.ParameterSetList)2 ConstantParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.ConstantParameterSpecGroup)1 LatinHypercubeParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.LatinHypercubeParameterSpecGroup)1 MonteCarloParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.MonteCarloParameterSpecGroup)1 ParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup)1