Examples of BaseExperiment


Examples of org.jamesii.core.experiments.BaseExperiment

  /**
   * Tests parameter combination generation in case one of the modifiers is
   * null.
   */
  public void testNullModifier() {
    BaseExperiment exp = new BaseExperiment();

    List<Integer> firstLevel = new ArrayList<>();
    firstLevel.add(1);
    firstLevel.add(2);

    List<Integer> secondLevel = new ArrayList<>();
    secondLevel.add(1);
    secondLevel.add(2);

    List<Integer> thirdLevel = new ArrayList<>();
    thirdLevel.add(0);

    List<ExperimentVariable<?>> expVars = new ArrayList<>();
    expVars.add(new ExperimentVariable<>("1", firstLevel.get(0),
        new SequenceModifier<>(firstLevel)));
    expVars.add(new ExperimentVariable<>("2", secondLevel.get(0),
        new SequenceModifier<>(secondLevel)));
    expVars.add(new ExperimentVariable<>("load", 0, null));

    exp.setupVariables(expVars);
    exp.getExperimentVariables().init(exp.getExperimentVariables());
    List<TestExecSetup> paramSetups = getSetups(exp.getExperimentVariables());
    for (int i = 0; i < paramSetups.size(); i++) {
      addInformation("#" + (i + 1) + ": "
          + Strings.dispMap(paramSetups.get(i).getFirstValue()));
    }
    assertEquals(firstLevel.size() * secondLevel.size(), paramSetups.size());
View Full Code Here

Examples of org.jamesii.core.experiments.BaseExperiment

*
*/
public class TestEmptyExperimentErrorHandling {

  public static void main(String[] args) {
    BaseExperiment be = new BaseExperiment();
    be.execute();
  }
View Full Code Here

Examples of org.jamesii.core.experiments.BaseExperiment

   */
  protected Pair<BaseExperiment, TaskRuntimeInformationListener> configureExperiment(
      SimTaskDescription taskDescription, ParameterBlock processorSetup) {

    // Set basics
    BaseExperiment exp = new BaseExperiment();
    exp.setModelLocation(taskDescription.uri);
    exp.setDefaultSimStopTime(taskDescription.stopTime);
    exp.setFixedModelParameters(taskDescription.modelParameters);
    exp.setRepeatRuns(replications);
    exp.setProcessorFactoryParameters(processorSetup);

    // Configure instrumenters
    configureInstrumentation(exp);

    // Configure parallel execution
    exp.setTaskRunnerFactory(new ParameterizedFactory<TaskRunnerFactory>(
        new ParallelComputationTaskRunnerFactory(), new ParameterBlock()
            .addSubBl(ParallelComputationTaskRunnerFactory.NUM_CORES, threads)));

    // Add listener
    TaskRuntimeInformationListener taskRTIListener =
        new TaskRuntimeInformationListener();
    exp.getExecutionController().addExecutionListener(taskRTIListener);
    return new Pair<>(exp, taskRTIListener);
  }
View Full Code Here

Examples of org.jamesii.core.experiments.BaseExperiment

    // nothing to do, yet
  }

  @Override
  public void finish(IWizard wizard) {
    BaseExperiment exp = wizard.getValue(ExperimentSetup.EXPERIMENT);

    // add data sink setup
    DataStorageFactory dsf = wizard.getValue(DataSinkSetup.DATASINK_FACTORY);
    ParameterBlock block = wizard.getValue(DataSinkSetup.DATASINK_PARAMETERS);
    if (dsf != null) {
      exp.setDataStorageFactory(new ParameterizedFactory<>(
          dsf, block));
    }

    ModelInstrumenterFactory mf =
        wizard.getValue(InstrumenterSetup.MODEL_INSTRUMENTER_FACTORY);
    ComputationInstrumenterFactory sf =
        wizard.getValue(InstrumenterSetup.SIMULATION_INSTRUMENTER_FACTORY);
    // read already selected parameters
    ParameterBlock mBlock =
        wizard.getValue(InstrumenterSetup.MODEL_INSTRUMENTER_PARAMETERS);
    ParameterBlock sBlock =
        wizard.getValue(InstrumenterSetup.SIMULATION_INSTRUMENTER_PARAMETERS);

    if (sf != null) {
      exp.setComputationInstrumenterFactory(new ParameterizedFactory<>(
          sf, sBlock));
    }
    if (mf != null) {
      exp.setModelInstrumenterFactory(new ParameterizedFactory<>(
          mf, mBlock));
    }

    // SimSystem.getTempDirectory()
    SimSystem.report(Level.INFO, "Starting the experiment from the workflow");

    // read model from
    // ISymbolicModel<?> model = (ISymbolicModel<?>)
    // wizard.getValue("model");

    /** The model location (temporary file of model description). */
    URI modelLocation = null;

    modelLocation = wizard.getValue(ModelLoader.MODEL_URI);
    // Entity.report("Will use model " + modelLocation);
    // Entity.report("Will not use model " +
    // wizard.getValue("modellocation"));

    exp.setModelLocation(modelLocation);

    exp.setName("Tut. WF Exp.: " + Files.getFileName(modelLocation));

    // exp.setDefaultSimStopTime(1000);
    // exp.setStartComputationTasksPaused(true);
    // exp.setComputationTaskInterStepDelay(500);

View Full Code Here

Examples of org.jamesii.core.experiments.BaseExperiment

    return super.getNextPage(currentPage, wizard);
  }

  @Override
  public void finish(IWizard wizard) {
    BaseExperiment exp = new BaseExperiment();

    // SimSystem.getTempDirectory()

    SimSystem.report(Level.INFO, "Starting the experiment from the workflow");

    // read model from
    // ISymbolicModel<?> model = (ISymbolicModel<?>) wizard.getValue("model");

    /** The model location (temporary file of model description). */
    URI modelLocation = null;

    modelLocation = wizard.getValue(ModelEditor.MODEL_LOCATION);
    // Entity.report("Will use model " + modelLocation);
    // Entity.report("Will not use model " + wizard.getValue("modellocation"));

    Map<String, ?> state =
        wizard.getValue(ModelParameterEditor.MODEL_PARAMETERS);
    Object user = wizard.getValue(ModelParameterEditor.USER_PARAMETERS);

    exp.setModelLocation(modelLocation);

    exp.setName("Tut. WF Exp.: " + Files.getFileName(modelLocation));

    exp.setExperimentVariables(new ExperimentVariables());

    ArrayList<Object> al = new ArrayList<>();
    al.add(state);

    // set model parameters
    if (state != null) {
      exp.getFixedModelParameters().putAll(state);
    }

    al = new ArrayList<>();
    al.add(user);
    exp.getExperimentVariables().addVariable(
        new ExperimentVariable<>("user.parameters",
            new SequenceModifier<>(al)));

    ParameterBlock afp = new ParameterBlock();
    afp.addSubBlock(AbstractModelInstrumenterFactory.MODELURI, modelLocation);

    List<ModelInstrumenterFactory> modelInstrFacs = null;
    List<ComputationInstrumenterFactory> simInstrFacs = null;
    boolean modelInstrumenter = true;
    boolean simInstumenter = true;
    try {
      modelInstrFacs =
          SimSystem.getRegistry().getFactoryList(
              AbstractModelInstrumenterFactory.class, afp);
    } catch (NoFactoryFoundException nffe) {
      modelInstrumenter = false;
    }

    try {
      simInstrFacs =
          SimSystem.getRegistry().getFactoryList(
              AbstractComputationInstrumenterFactory.class, afp);
    } catch (NoFactoryFoundException nffe) {
      simInstumenter = false;
      SimSystem.report(Level.INFO, null, "No instrumenter found for model: "
          + modelLocation, null);
    }
    if (simInstumenter || modelInstrumenter) {
      List<Factory> instrFacs = new ArrayList<>();
      if (modelInstrFacs != null) {
        instrFacs.addAll(modelInstrFacs);
      }
      if (simInstrFacs != null) {
        instrFacs.addAll(simInstrFacs);
      }

      FactorySelectionDialog<Factory<?>> diag =
          new FactorySelectionDialog(null, instrFacs, null,
              "Select Instrumentation", true);
      diag.setVisible(true);
      if (diag.isOkButtonPressed()) {
        List<ParameterizedFactory<Factory<?>>> selected =
            diag.getSelectedFactoriesAndParameters();

        ParameterizedFactory<Factory<?>> sel = new ParameterizedFactory<>();
       
        if (selected.size() > 0) {
          sel = selected.get(0);
        }

        if (sel.getFactory() instanceof ModelInstrumenterFactory) {
          ModelInstrumenterFactory min =
              (ModelInstrumenterFactory) sel.getFactory();
         
          exp.setModelInstrumenterFactory(new ParameterizedFactory<>(min,sel.getParameters()));
        }

        if (sel.getFactory() instanceof ComputationInstrumenterFactory) {
          ComputationInstrumenterFactory min =
              (ComputationInstrumenterFactory) sel.getFactory();
         
          exp.setComputationInstrumenterFactory(new ParameterizedFactory<>(min,sel.getParameters()));
        }
      }
      // for (ModelInstrumenterFactory m : instrFacs) {
      // if (m.getClass().getName().compareTo(sel.toString()) == 0) min = m;
      // }
View Full Code Here

Examples of org.jamesii.core.experiments.BaseExperiment

  public void openExperiment(ExperimentReaderFactory expRWFac,
      ParameterBlock param) {
    // IExperimentWriter writer = expRWFac.getWriter(param);
    IExperimentReader reader = expRWFac.create(param, SimSystem.getRegistry().createContext());
    try {
      BaseExperiment exp = reader.readExperiment(param);
      if (exp == null) {
        SimSystem.report(Level.SEVERE, null,
            "Error opening experiment located at '" + getExpLocation(param)
                + "' with reader + '" + reader.getClass().toString() + "'",
            null);
        return;
      }
      getWindowManager().addWindow(new ExperimentEditor(exp, param));
      SimSystem.report(Level.INFO, null, "Opened experiment '" + exp.getName()
          + "' from " + getExpLocation(param), null);
    } catch (IOException ex) {
      SimSystem.report(Level.SEVERE, null,
          "Error opening experiment located at '" + getExpLocation(param)
              + "' with reader + '" + reader.getClass().toString() + "'", null,
View Full Code Here

Examples of org.jamesii.core.experiments.BaseExperiment

    pb.addSubBlock("experimentInfo", new ParameterBlock(info));
    IExperimentReader reader =
        SimSystem.getRegistry()
            .getFactory(AbstractExperimentReaderFactory.class, pb).create(null, SimSystem.getRegistry().createContext());

    BaseExperiment exp = null;
    try {
      exp = reader.readExperiment(pb);
    } catch (IOException ex) {
      SimSystem.report(ex);
    }
View Full Code Here

Examples of org.jamesii.core.experiments.BaseExperiment

   *           if something goes wrong
   */
  @Override
  protected List<List<RunInformation>> doInBackground() {
    experiment.execute();
    BaseExperiment exp = experiment;
    experiment = null;
    return exp.getResults();
  }
View Full Code Here

Examples of org.jamesii.core.experiments.BaseExperiment

  @Override
  public void execute() {
    CreateNewExperimentDialog newExpDialog =
        new CreateNewExperimentDialog(null, null);
    BaseExperiment experiment = newExpDialog.showDialog();
    if (experiment == null) {
      return;
    }
    winManager.addWindow(new ExperimentEditor(experiment, null, null));
  }
View Full Code Here

Examples of org.jamesii.core.experiments.BaseExperiment

      SimSystem.report(Level.SEVERE, "Error: Malformed URI. The URI '"
          + uriString + "' is malformed.");
      return;
    }

    experiment = new BaseExperiment();
    experiment.setName(experimentNameField.getText());
    experiment.setModelLocation(uriToUse);
    // TODO: Let model reading be parameterisable
    // experiment.setModelRWParameters();
    this.setVisible(false);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.