Skip to content

Commit

Permalink
Merge pull request #78 from hectorpal/hp/adding-ff
Browse files Browse the repository at this point in the history
Adding FF
  • Loading branch information
haz authored Jun 6, 2022
2 parents 85603f0 + 50ffbf5 commit bf2567c
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ run a number of the planners (all those that are based on singularity), you will
to run the docker with the `--privileged` option.

**Build planutils images**
`docker build -t planutils:latest . `
`docker build -t planutils:latest .`

**Run the plautils container**
`docker run -it --privileged planutils bash`
Expand Down
7 changes: 7 additions & 0 deletions planutils/packages/ff/install
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
13 changes: 13 additions & 0 deletions planutils/packages/ff/manifest.json
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"
}
}
}
}
47 changes: 47 additions & 0 deletions planutils/packages/ff/run
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
4 changes: 4 additions & 0 deletions planutils/packages/ff/uninstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

rm ./bin/ff
rmdir ./bin

0 comments on commit bf2567c

Please sign in to comment.