Search in sources :

Example 6 with ParameterSpecification

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

the class ParameterSpecGroupPanel method getParameterSpecGroup.

public ParameterSpecGroup getParameterSpecGroup() {
    ParameterSpecGroup group = new ParameterSpecGroup(validCardinality);
    for (ParameterSpecPanel pnlSpec : specPanels.keySet()) {
        // TODO: hierarchical?
        Object paramKey = pnlSpec.getParamBundle().getParameter().getKey();
        List<ParameterDomain> domains = pnlSpec.getParamBundle().getDomains();
        ParameterKeyPath keyPath = new ParameterKeyPath();
        for (ParameterDomain domain : domains) {
            keyPath.add(domain.getName());
        }
        keyPath.add(paramKey);
        ParameterSpecification spec = pnlSpec.getSpecification();
        group.add(keyPath, spec);
    }
    return group;
}
Also used : ConstantParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.ConstantParameterSpecification) ParameterSpecification(gov.sandia.n2a.parms.ParameterSpecification) UniformParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.UniformParameterSpecification) EvenSpacingParameterSpecification(gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification) ParameterKeyPath(gov.sandia.n2a.parms.ParameterKeyPath) ParameterDomain(gov.sandia.n2a.parms.ParameterDomain) ParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup)

Example 7 with ParameterSpecification

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

the class UIController method divideEnsembleParams.

// Any group in origSet for which the Simulator can handle parameterization
// is removed from origSet and added to the returned set
private ParameterSpecGroupSet divideEnsembleParams(MNode model, ParameterSpecGroupSet origSet, Backend sim) {
    // Three cases:
    // 1) framework handles all in group
    // 2) simulator handles all in group
    // 3) (changed) sim can only handle some of group; so have framework handle group instead
    ParameterSpecGroupSet result = new ParameterSpecGroupSet();
    for (ParameterSpecGroup group : origSet) {
        if (group == origSet.getDefaultValueGroup()) {
            // don't want to transfer default value group to simulator groups
            continue;
        }
        int numHandled = 0;
        ParameterSpecification spec = null;
        Object errorKey = null;
        for (Object key : group.keySet()) {
            spec = group.get(key);
            if (sim.canHandleRunEnsembleParameter(model, key, spec)) {
                numHandled++;
            } else if (numHandled != 0) {
                errorKey = key;
                break;
            }
        }
        if (numHandled != group.size() && numHandled != 0) {
            System.out.println("this simulator cannot handle '" + errorKey + "' with specification '" + spec.getShortName());
        } else if (numHandled != 0) {
            result.add(group);
        }
    }
    for (ParameterSpecGroup group : result) {
        origSet.remove(group);
    }
    return result;
}
Also used : ParameterSpecification(gov.sandia.n2a.parms.ParameterSpecification) ParameterSpecGroup(gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup) ParameterSpecGroupSet(gov.sandia.umf.platform.ensemble.params.groupset.ParameterSpecGroupSet) ExtensionPoint(gov.sandia.n2a.plugins.ExtensionPoint)

Aggregations

ParameterSpecification (gov.sandia.n2a.parms.ParameterSpecification)7 EvenSpacingParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.EvenSpacingParameterSpecification)5 UniformParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.UniformParameterSpecification)5 ParameterSpecGroup (gov.sandia.umf.platform.ensemble.params.groups.ParameterSpecGroup)3 ConstantParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.ConstantParameterSpecification)3 ParameterDomain (gov.sandia.n2a.parms.ParameterDomain)2 ListParameterSpecification (gov.sandia.umf.platform.ensemble.params.specs.ListParameterSpecification)2 Parameter (gov.sandia.n2a.parms.Parameter)1 ParameterBundle (gov.sandia.n2a.parms.ParameterBundle)1 ParameterKeyPath (gov.sandia.n2a.parms.ParameterKeyPath)1 ExtensionPoint (gov.sandia.n2a.plugins.ExtensionPoint)1 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 ParameterSpecGroupSet (gov.sandia.umf.platform.ensemble.params.groupset.ParameterSpecGroupSet)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 JPanel (javax.swing.JPanel)1 ChangeEvent (javax.swing.event.ChangeEvent)1 ChangeListener (javax.swing.event.ChangeListener)1