Difference between revisions of "Adding an example"

From SUMOwiki
Jump to navigationJump to search
Line 1: Line 1:
If you want to create a metamodel for your own problem ([[simulator]]) you will first have to write a simulator xml file.  To do this simply open one of the existing simulator xml files (in the examples directory) and create a copy of it in the same directory but under a new name.  You can then edit this file to suit your particular problem. This file should be pretty straightforward to write.
+
If you want to create a surrogate model (metamodel) for your own problem you will first have to write a [[simulator]] xml file.  To do this simply open one of the existing simulator xml files (in the examples directory) and create a copy of it in the same directory but under a new name.  You can then edit this file to suit your particular problem. This file should be pretty straightforward to write.
  
 
Your simulator XML file may specify different implementations:
 
Your simulator XML file may specify different implementations:
Line 10: Line 10:
  
 
See the [[Simulator configuration]] page for a full list of the possibilities.
 
See the [[Simulator configuration]] page for a full list of the possibilities.
Note that all _input_ data (not output values) to the toolbox is required to be scaled to [-1 1]! So make sure you have scaled your datasets or wrapped your executable. In case of doubt about which dataset to use, use scattered. Datasets should be placed in examples/data/txt.
+
In case of doubt about which dataset to use, use scattered. Datasets should be placed in examples/data/txt.  Matlab scripts should be placed in src/matlab/examples.
  
For an explanation of the data format and how the toolbox interfaces with the [[simulator]], see the [[Data format]] 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 default.xml so it uses your file (<Simulator> tag).  Finally you just run 'go'.
 
Having written your simulator XML file and provided the datasets/executables you now just need to change default.xml so it uses your file (<Simulator> tag).  Finally you just run 'go'.
  
Note that, depending on wether your simulator is a script, native executable, dataset or matlab script you will need to set different configuration options.  For example, if your data comes from a dataset you will have to set the sample evaluator to scattered or gridded, depending if you datapoints 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 local sample evaluator with the type 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 matlab.
+
Note that, depending on whether your simulator is a script, native executable, dataset or matlab script you will need to set different configuration options.  For example, if your data comes from a dataset you will have to set the sample evaluator to scattered or gridded, depending if you datapoints 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 local sample evaluator with the type 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 matlab.
 
 
See the [[Simulator configuration]] page for explanations of the available options.
 

Revision as of 16:09, 30 January 2008

If you want to create a surrogate model (metamodel) for your own problem you will first have to write a simulator xml file. To do this simply open one of the existing simulator xml files (in the examples directory) and create a copy of it in the same directory but under a new name. You can then edit this file to suit your particular problem. This file should be pretty straightforward to write.

Your simulator XML file may specify different implementations:

  • an executable or script (<Executable> tag)
  • a Java class (<Executable> tag, platform = java)
  • a matlab script (<Executable> tag, platform = matlab)
  • a dataset
    • scattered data (<ScatteredDataFile> tag)
    • gridded data, data lies on a regular grid (<GriddedDataFile>)

See the Simulator configuration page for a full list of the possibilities. In case of doubt about which dataset to use, use scattered. Datasets should be placed in examples/data/txt. Matlab scripts should be placed in src/matlab/examples.

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 file (<Simulator> tag). Finally you just run 'go'.

Note that, depending on whether your simulator is a script, native executable, dataset or matlab script you will need to set different configuration options. For example, if your data comes from a dataset you will have to set the sample evaluator to scattered or gridded, depending if you datapoints 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 local sample evaluator with the type 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 matlab.