Search in sources :

Example 1 with ParameterSpecGroup

use of gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup in project n2a by frothga.

the class ParameterSpecGroupSet method consts.

private static void consts() {
    ConstantParameterSpecGroup group = new ConstantParameterSpecGroup();
    group.addConstParameter("A", 43.2);
    group.addConstParameter("B", 32.4);
    group.addConstParameter("C", 87.2);
    group.addConstParameter("D", 111.2);
    ParameterSpecGroup group2 = new ParameterSpecGroup(4);
    group2.add("Z", new ListParameterSpecification(true, false, false, true));
    ParameterSpecGroupSet groups = new ParameterSpecGroupSet();
    groups.add(group);
    groups.add(group2);
    groups.printParameterSets();
}
Also used : ListParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.ListParameterSpecification) 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) ConstantParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.ConstantParameterSpecGroup)

Example 2 with ParameterSpecGroup

use of gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup in project n2a by frothga.

the class ParameterSpecGroupSet method validate.

// ////////
// MISC //
// ////////
public void validate() throws ParameterSpecGroupSetValidationException {
    Set<Object> paramKeys = new HashSet<Object>();
    Set<Integer> specHashCodes = new HashSet<Integer>();
    for (ParameterSpecGroup group : this) {
        for (Object paramKey : group.keySet()) {
            ParameterSpecification spec = group.get(paramKey);
            // Validate
            if (specHashCodes.contains(spec.objectHashCode())) {
                throw new ParameterSpecGroupSetValidationException("Multiple parameter groups contain the same specification object '" + spec.getClass().getSimpleName() + "@" + spec.hashCode() + "'.  A specification object should be added to only a single group because it is permitted to save state between calls.");
            }
            if (group != defaultValueGroup && paramKeys.contains(paramKey)) {
                throw new ParameterSpecGroupSetValidationException("Multiple parameter groups contain a specification for the parameter '" + paramKey + "'.");
            }
            // Save
            specHashCodes.add(spec.objectHashCode());
            if (group != defaultValueGroup) {
                // Default value parameters do not prevent
                paramKeys.add(paramKey);
            // other groups from having the same parameters.
            }
            // Max values
            int max = spec.getMaxValues();
            if (max != -1 && group.getRunCount() > max) {
                throw new ParameterSpecGroupSetValidationException("Specification for parameter '" + paramKey + "' has a maximum run count less than the run count of its group.");
            }
        }
    }
}
Also used : UniformParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.UniformParameterSpecification) EvenSpacingParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification) ListParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.ListParameterSpecification) ParameterSpecification(gov.sandia.n2a.parms.ParameterSpecification) 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) HashSet(java.util.HashSet)

Example 3 with ParameterSpecGroup

use of gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup in project n2a by frothga.

the class ParameterSpecGroupSet method add.

// Just short hand for a SINGLE-parameter spec group,
// but still returns the reference to the group for
// convenience.
public ParameterSpecGroup add(int iterations, String name, ParameterSpecification spec) {
    ParameterSpecGroup group = new ParameterSpecGroup(iterations);
    group.put(name, spec);
    add(group);
    return group;
}
Also used : 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)

Example 4 with ParameterSpecGroup

use of gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup in project n2a by frothga.

the class ParameterSpecGroupSet method list.

public void list(boolean includeDVGroup) {
    for (ParameterSpecGroup group : this) {
        if (!includeDVGroup && group == defaultValueGroup) {
            continue;
        }
        if (group == defaultValueGroup) {
            System.out.print("<DV>");
        }
        System.out.println(group);
        group.list(4);
    }
}
Also used : 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)

Example 5 with ParameterSpecGroup

use of gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup in project n2a by frothga.

the class ParameterSpecGroupSet method getRunCount.

public long getRunCount(boolean includeDVGroup) throws ParameterSpecGroupSetValidationException {
    validate();
    long product = 1;
    boolean atLeastOne = false;
    for (ParameterSpecGroup group : this) {
        if (!includeDVGroup && group == defaultValueGroup) {
            continue;
        }
        product *= group.getRunCount();
        atLeastOne = true;
    }
    return atLeastOne ? product : 0;
}
Also used : 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

ParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup)10 ConstantParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.ConstantParameterSpecGroup)7 LatinHypercubeParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.LatinHypercubeParameterSpecGroup)7 MonteCarloParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.MonteCarloParameterSpecGroup)7 ParameterSpecification (gov.sandia.n2a.parms.ParameterSpecification)3 EvenSpacingParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification)3 ListParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.ListParameterSpecification)3 UniformParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.UniformParameterSpecification)3 ParameterSpecGroupSet (gov.sandia.umf.platform.ensemble.params.groupset.ParameterSpecGroupSet)2 ParameterDomain (gov.sandia.n2a.parms.ParameterDomain)1 ParameterKeyPath (gov.sandia.n2a.parms.ParameterKeyPath)1 ParameterSet (gov.sandia.n2a.parms.ParameterSet)1 ExtensionPoint (gov.sandia.n2a.plugins.ExtensionPoint)1 ParameterSetList (gov.sandia.umf.platform.ensemble.params.ParameterSetList)1 ConstantParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.ConstantParameterSpecification)1 HashSet (java.util.HashSet)1