-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from hectorpal/hp/adding-ff
Adding FF
- Loading branch information
Showing
5 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
mkdir bin | ||
cd bin | ||
wget 'https://github.com/hectorpal/fast-forward-linux-binaries/raw/main/ff.gz' | ||
gunzip ff.gz | ||
chmod +x ff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "Fast-Forward", | ||
"description": "https://fai.cs.uni-saarland.de/hoffmann/ff.html", | ||
"install-size": "1.1M", | ||
"dependencies": [], | ||
"endpoint": { | ||
"services": { | ||
"solve": { | ||
"template": "planner" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
# whatever command-line method needs to be used to run this package | ||
|
||
FF=$(dirname $0)/bin/ff | ||
if [ -z "$1" ]; then | ||
cat << EOF | ||
Planutils: | ||
* First two arguments are <domain or operator> and <problem or facts> | ||
* Extra arguments will be passed to FF | ||
Original FF help: | ||
EOF | ||
$FF | ||
exit 1 | ||
fi | ||
|
||
# https://stackoverflow.com/questions/4632028/how-to-create-a-temporary-directory | ||
WORK_DIR=`mktemp -d` | ||
|
||
# check if tmp dir was created | ||
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then | ||
echo "Could not create temp dir" | ||
exit 1 | ||
fi | ||
|
||
function cleanup { | ||
rm -rf "$WORK_DIR" | ||
# echo "Deleted temp working directory $WORK_DIR" | ||
} | ||
# register the cleanup function to be called on the EXIT signal | ||
trap cleanup EXIT | ||
|
||
OUT=$WORK_DIR/ff.out | ||
ERR=$WORK_DIR/ff.err | ||
|
||
DOMAIN=$1 | ||
PROBLEM=$2 | ||
shift 2 | ||
$FF -o $DOMAIN -f $PROBLEM $@ > $OUT 2>$ERR | ||
# Getting plan | ||
grep '[0-9]:' $OUT | cut -d : -f 2- | \ | ||
awk '{$1=$1;print}' | \ | ||
awk -F" " '{ print("(", $0, ")")}' > $PROBLEM.plan | ||
|
||
cat $OUT >&1 | ||
cat $ERR >&2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
rm ./bin/ff | ||
rmdir ./bin |