File: DeveloperCommand.htm

package info (click to toggle)
cain 1.10+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 29,856 kB
  • sloc: cpp: 49,612; python: 14,988; xml: 11,654; ansic: 3,644; makefile: 133; sh: 2
file content (79 lines) | stat: -rw-r--r-- 3,272 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

<html>
<head>
<title>Command Line Solvers</title>
</head>
<body>
<h1>Command Line Solvers</h1>

<p>
For most methods, Cain uses command line executables to carry out
the simulations. The executables are in the <tt>solvers</tt> directory.
</p>

<p>
It is easy to add a new simulation method to Cain if it is similar to
one of the built-in methods. Just write a
program that reads the same <a href="DeveloperFile.htm">input format</a>
and generates the same output
format as one of the other solvers. You can write your program in any
language and use any software or hardware resources that you have on
your machine.
Place your program in the <tt>solvers</tt>
directory. Then edit the data in the file
<tt>state/simulationMethods.py</tt>.
Note that the Cain solvers are serial.
The application utilizes concurrency by running multiple
instances of a solver. If your solver has multiple threads, then you
should select one process in the launcher panel when using your
solver, so that only one instance of the solver is run.
</p>

<p>
If you would like to add a solver to the Cain distribution, contact
me at <img src="seanEmail.png">. Your work will be noted in
the <a href="Simulation.htm">Simulation Methods</a> chapter of this
documentation. I will add links to any of your relevant papers and web
sites. The contributed code will be distributed under the three-clause
BSD <a href="License.htm">license</a>.
</p>

<p>
While there is great flexibility in developing personal extensions to Cain,
contributed solvers should roughly match the built-in solvers. The
best way to proceed is to use an existing solver as a template. You
will want to use the random number package in
<tt>src/numerical/random</tt>. The solvers take an initial state of
the Mersenne Twister as input and return the final state.
Note that most of the built-in solvers can either be used with
mass action kinetics or custom propensities (i.e. the propensity
functions for the reactions may be any user-defined function).
To accomplish this, the C++ solver classes take the propensities
functor as a template parameter. For mass action kinetics, the
propensity functor will be either <tt>PropensitiesSingle</tt>
or <tt>PropensitiesAll</tt>, which are defined in
<tt>src/stochastic/Propensities.h</tt>. For custom propensities,
the propensity functor is the <tt>Propensities</tt> class,
defined in <tt>src/solvers/Propensities.h</tt>. When a solver
with custom propensities is run, the application generates
appropriate C++ code, compiles the solver, and then launches it.
When writing your solver, it may be easier to initially support only
mass-action kinetics. Once that is working, you may add the
custom propensities capability.
</p>

<p>
When developing your solver, you can either put it in the
<tt>src/solvers</tt> directory and use the makefile there to
compile it, or you may place it in an arbitrary directory.
If you choose the latter option. Copy the contents of <tt>src</tt>
to a convenient location and add it to your include path.
Note that all of the packages in <tt>src</tt> are template
class libraries. That is, they are just header files. To
use a package, simply include the appropriate header.
There is no need to compile any libraries and link with
them.
</p>

</body>
</html>