If you have a multiple core machine you would like to parallelize the precalculations. The new svarog (0.0.6) contains four Perl scripts that help to do it. While you are free to write your own scripts using the svarog-merge tool (created in 0.0.5) it is more convenient to use these scripts:
In order to use them do the following steps:
- create a new directory and enter it
- copy a valid Svarog specification (without any commands) into it, for example as specification.svarog
- copy specification.svarog into create_visible_states.svarog and append "cout << visible states << eol;" to it.
- execute: svarog create_visible_states.svarog > visible_states.txt
- check the amount of lines in visible_states.txt, in dorban's case it was 360
- execute: svarog_generate_precalculate_tasks.pl 4 2 specification.svarog visible_states.txt
- execute: svarog_generate_precalculate_shell.pl 360 > precalculate.sh
- execute: bash precalculate.sh
This will start the precalculations on all your processors, in parallel. In order to check whether they terminated you can use a control shell:
- execute: svarog_generate_control_shell.pl 360 > control.sh
- execute: bash control.sh
If there are any errors this probably means that some precalculations did not terminate yet. You can use the ps shell command to check whether any svarogs are still running. When the control.sh reports no errors you will want to merge the Svarog specifications created by your tasks in the directory KNOWLEDGE:
- execute: svarog_generate_merge_shell.pl 360 > merge.sh
- execute: bash merge.sh
The result Svarog specification containing the precalculated knowledge will be the file result.svarog.
You should of course replace 360 in the above examples with the actual amount of visible states in your case.
Replace 4 (the first argument for svarog_generate_precalculate_tasks.pl) with the depth you want for the precalculations. It will affect the time required for the precalculations, but not the result size.