| 1 |
Converging Workflow |
| 2 |
=================== |
| 3 |
|
| 4 |
.. admonition:: Get a copy of this example |
| 5 |
:class: hint |
| 6 |
|
| 7 |
.. code-block:: console |
| 8 |
|
| 9 |
$ cylc get-resources examples/converging-workflow |
| 10 |
|
| 11 |
A workflow which runs a pattern of tasks over and over until a convergence |
| 12 |
condition has been met. |
| 13 |
|
| 14 |
* The ``increment`` task runs some kind of model or process which increments |
| 15 |
us toward the solution. |
| 16 |
* The ``check_convergence`` task, checks if the convergence condition has been |
| 17 |
met. |
| 18 |
|
| 19 |
.. literalinclude:: flow.cylc |
| 20 |
:language: cylc |
| 21 |
|
| 22 |
Run it with:: |
| 23 |
|
| 24 |
$ cylc vip converging-workflow |
| 25 |
|
| 26 |
.. admonition:: Example - Genetic algorithms |
| 27 |
:class: hint |
| 28 |
|
| 29 |
.. _genetic algorithm: https://en.wikipedia.org/wiki/Genetic_algorithm |
| 30 |
|
| 31 |
An example of a converging workflow might be a `genetic algorithm`_, where you |
| 32 |
"breed" entities, then test their "fitness", and breed again, over and over |
| 33 |
until you end up with an entity which is able to satisfy the requirement. |
| 34 |
|
| 35 |
.. digraph:: Example |
| 36 |
|
| 37 |
random_seed -> breed -> test_fitness |
| 38 |
test_fitness -> breed |
| 39 |
test_fitness -> stop |