diff options
| author | Ian Gent | 2018-08-10 18:51:43 +0100 |
|---|---|---|
| committer | Ian Gent | 2018-08-10 18:51:43 +0100 |
| commit | 79b7c458b86dc3e32074fc29468e955bb5ab149f (patch) | |
| tree | a8e227952b6219768611880cd7ece9a2b7a1879a | |
| parent | Merge branch 'ipg' of github.com:thecharlesblake/Solvitaire into ipg (diff) | |
| download | metasol-79b7c458b86dc3e32074fc29468e955bb5ab149f.tar.gz metasol-79b7c458b86dc3e32074fc29468e955bb5ab149f.zip | |
solvability script
| -rwxr-xr-x | solvability.sh | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/solvability.sh b/solvability.sh index eae6636..1770fc0 100755 --- a/solvability.sh +++ b/solvability.sh @@ -3,44 +3,19 @@ if [ "$#" != 4 ]; then echo "Usage: <seeds> <cores> \"<solvitaire_command>\" <output_file>" - echo "e.g.: ./solvability.sh 1000 40 \"sol --type alpha-star --timeout 6000 --str smart-solvability\" results.csv" + echo "e.g.: ./solvability.sh 1000 40 \"sol --type alpha-star --timeout 6000 --str smart-solvability\" results" exit 1 fi -tmp=".tmp" - -cleanup () { - if [ -d "$tmp" ]; then - rm -r "$tmp" - fi -} - -writetofile () { - if [ -d "$tmp" ]; then - echo "Attempted Seed, Outcome, Time Taken(ms), States Searched, Unique States Searched, Backtracks, Dominance Moves, States Removed From Cache, Final States In Cache, Final Buckets In Cache, Maximum Search Depth, Final Search Depth" > "$out" - cat "$tmp"/*/*/stdout >> "$out" - fi -} - -exitfn () { - if [ -d "$tmp" ]; then - writetofile - cleanup - exit - fi -} - - seeds="$1" cores="$2" sol_command="$3" +minramfree="100G" out="$4" -cleanup -trap "exitfn" INT +echo "Attempted Seed, Outcome, Time Taken(ms), States Searched, Unique States Searched, Backtracks, Dominance Moves, States Removed From Cache, Final States In Cache, Final Buckets In Cache, Maximum Search Depth, Final Search Depth" > "$out.csv" -parallel --results "$tmp" --progress -j"$cores" "$sol_command" --ra {} --class ::: $(seq "$seeds") >/dev/null +seq "$seeds" | parallel --joblog $out.log --progress --memfree $minramfree -j"$cores" "$sol_command" --ra {} --class >> "$out.csv" -exitfn |
