Difference between revisions of "Adding an example"

From SUMOwiki
Jump to navigationJump to search
Line 3: Line 3:
 
== Project directories ==
 
== Project directories ==
  
Since version 6.0 every example (and all related files) is self contained in a project directory.  See <code>examples/</code> for a list of examples and associated project directoriesYou can use one of them as an example for how to add your own.
+
The SUMO Toolbox comes with a large number of example problems and datasets which you can use for testing, benchmarking, or simply to get a feel of what is possibleThese problems cover a very large range of domains, from Biology to Geography and Electronics.
  
== Simulator file ==
+
Since version 6.0 every example (and all related files) is self contained in a project directory.  See <code>examples/</code> for a list of examples and associated project directories.
 +
If you open one of those directories you will see they contain the following things:
 +
 
 +
# A simulator xml file with the same name as the project directory (mandatory)
 +
# One or more executables: matlab script, C++ file, binary, ... (optional)
 +
# One or more data files (optional)
 +
# Alternative simulator xml files (optional)
 +
# Other files, e.g., a documenting pdf (optional)
  
If you want to create a surrogate model (metamodel) for your own problem you will first have to write a [[simulator]] xml file. Again, use one of the exsiting simulator xml files (from on of the examples) as a guide.  The simulator xml file should have the same name and capitalization as the project directory (except for the .xml extension).  Also see the [[Simulator configuration]] page.
+
You can structure the directory as you please but make sure it contains at least the simulator xml and a dataset or executable.
  
You can then edit this file to suit your particular problem. This file should be pretty straightforward to write.
+
== Simulator file ==
  
'''For versions < 6.0:'''
+
If you want to create a surrogate model (metamodel) for your own problem you will first have to write a simple [[simulator]] [[FAQ#What is XML|XML]] file. You can use one of the existing simulator XML files (from one of the examples) as a guide.  The simulator xml file should have the same name and capitalization as the project directory (except for the .xml extension).
Datasets should be placed in <code>examples/data/txt</code>.  
+
You can then edit this file to suit your particular problem (see also [[Simulator configuration]]).
In case of doubt about which dataset to use, use 'ScatteredDataFile'.
 
Matlab scripts should be placed in <code>src/matlab/examples</code>.
 
  
'''For version 6.0:'''
+
Then just place any datasets, Matlab scripts, ... into that directory.  For requirements on the structure of the dataset or signature of the executable/script please see [[Interfacing with the toolbox]].
You can just copy the Datasets, matlab scripts, extra files in the project directory you created in the steps above.
 
  
 
For an explanation of the data format and how the toolbox interfaces with the [[simulator]], see the [[Interfacing with the toolbox]] page.
 
For an explanation of the data format and how the toolbox interfaces with the [[simulator]], see the [[Interfacing with the toolbox]] page.
  
Having written your simulator XML file and provided the datasets/executables you now just need to change <code>default.xml</code> so it uses your problem (<Simulator> tag).  Finally you just run '<code>go</code>'.  In version 5.0 of the toolbox you would just use the name of the simulator configuration file, for version 6.0 you must specify the project directory name (can be an absolute path or a directory name inside the toolbox path).
+
Having written your simulator XML file and provided the datasets/executables you now just need to change <code>default.xml</code> so it uses your problem (<Simulator> tag).  For information on this see [[Running#Running different examples]].
 
 
Note that, depending on whether your simulator is a script, native executable, dataset or Matlab script you will need to set different [[Config:SampleEvaluator| sample evaluator]] configuration options.  For example, if your data comes from a dataset you will have to set the sample evaluator to [[Config:SampleEvaluator#scattered| scattered]] or [[Config:SampleEvaluator#gridded| gridded]], depending if you data points are scattered or on a regular grid. 
 
If on the other hand your data comes from a native executable you would want to use the [[Config:SampleEvaluator#local| local]] sample evaluator with the simulatorType set to "external" (you can also set the type to "java" if your executable is a java class).  For Matlab scripts the sample evaluator to use is [[Config:SampleEvaluator#matlab| matlab]].
 

Revision as of 15:39, 10 June 2009

This page explains how to add your own data/simulation code/... to the toolbox to model it.

Project directories

The SUMO Toolbox comes with a large number of example problems and datasets which you can use for testing, benchmarking, or simply to get a feel of what is possible. These problems cover a very large range of domains, from Biology to Geography and Electronics.

Since version 6.0 every example (and all related files) is self contained in a project directory. See examples/ for a list of examples and associated project directories. If you open one of those directories you will see they contain the following things:

  1. A simulator xml file with the same name as the project directory (mandatory)
  2. One or more executables: matlab script, C++ file, binary, ... (optional)
  3. One or more data files (optional)
  4. Alternative simulator xml files (optional)
  5. Other files, e.g., a documenting pdf (optional)

You can structure the directory as you please but make sure it contains at least the simulator xml and a dataset or executable.

Simulator file

If you want to create a surrogate model (metamodel) for your own problem you will first have to write a simple simulator XML file. You can use one of the existing simulator XML files (from one of the examples) as a guide. The simulator xml file should have the same name and capitalization as the project directory (except for the .xml extension). You can then edit this file to suit your particular problem (see also Simulator configuration).

Then just place any datasets, Matlab scripts, ... into that directory. For requirements on the structure of the dataset or signature of the executable/script please see Interfacing with the toolbox.

For an explanation of the data format and how the toolbox interfaces with the simulator, see the Interfacing with the toolbox page.

Having written your simulator XML file and provided the datasets/executables you now just need to change default.xml so it uses your problem (<Simulator> tag). For information on this see Running#Running different examples.