diff --git a/planutils/packages/metric-ff/manifest.json b/planutils/packages/metric-ff/manifest.json index 2156851..0f19b3f 100644 --- a/planutils/packages/metric-ff/manifest.json +++ b/planutils/packages/metric-ff/manifest.json @@ -1,14 +1,90 @@ { - "name": "Metric Fast-Forward: extended with numerical state variables", - "description": "The system is an extension of the FF planner to numerical state variables, more precisely to PDDL2.1 level 2.", - "homepage": "https://fai.cs.uni-saarland.de/hoffmann/metric-ff.html", - "install-size": "1.8M", - "dependencies": [], - "endpoint": { - "services": { - "solve": { - "template": "planner" - } + "name": "Metric Fast-Forward: extended with numerical state variables", + "description": "The system is an extension of the FF planner to numerical state variables, more precisely to PDDL2.1 level 2.", + "homepage": "https://fai.cs.uni-saarland.de/hoffmann/metric-ff.html", + "install-size": "1.8M", + "dependencies": [], + "endpoint": { + "services": { + "solve": { + "template": "planner", + "args": [ + { + "name": "random_seed", + "type": "int", + "description": "Random seed (for random restarts)", + "default": 0 + }, + { + "name": "cost_minimization", + "description": "Whether or not to use cost-minimizing relaxed plans with A*.", + "type": "categorical", + "default": 1, + [ + { + "display_value": + "Use them [default]", + "value": 1 + }, + {"display_value": + "Do not use.", + "value": 0 + } + ] + }, + { + "name": "cost_bound", + "type": "float", + "description": "Upper bound on solution cost (with cost minimization).", + }, + { + "name": "search_configuration", + "type": "categorical", + "description": "Search configuration.", + "choices": [ + { + "display_value": "Standard-FF: EHC+H then BFS (cost minimization: NO)", + "value": 0 + }, + { + "display_value": "BFS (cost minimization: NO)", + "value": 1 + } + { + "display_value": "BFS + helpful actions pruning (cost minimization: NO)", + "value": 2 + }, + { + "display_value": + "Weighted A* (cost minimization: YES)", + "value": 3 + }, + { + "display_value": + "A*epsilon (cost minimization: YES)", + "value": 4 + }, + { + "display_value": + "EHC + helpful actions pruning, then A*epsilon (cost minimization: YES)", + "value": 5 + } + ] + }, + { + "name": "weight", + "default": 5, + "description": "Weight for search configs in A*." + } + ], + "call": + "{package_name} -r {random_seed} -s {search_configuration} -w {weight} -b {cost_bound} -c {cost_minimization} -o {domain} -f {problem} >> plan", + "return": { + "type": "log", + "files": "*plan*" + } + } + } } - } } + diff --git a/planutils/packages/metric-ff/run b/planutils/packages/metric-ff/run index 70c00dc..1b35935 100755 --- a/planutils/packages/metric-ff/run +++ b/planutils/packages/metric-ff/run @@ -34,10 +34,57 @@ trap cleanup EXIT OUT=$WORK_DIR/ff.out ERR=$WORK_DIR/ff.err -DOMAIN=$1 -PROBLEM=$2 +args="" +weight="" +cost_min=1 + +while getopts 'r:s:w:b:c:o:f:' opt; do + case "$opt" in + r) + args+=" -r ${OPTARG}" + ;; + s) + search="${OPTARG}" + args+=" -s ${OPTARG}" + ;; + w) + weight="${OPTARG}" + ;; + b) + bound="${OPTARG}" + ;; + c) + cost_min=${OPTARG} + ;; + o) + args+=" -o ${OPTARG}" + ;; + f) + args+=" -s ${OPTARG}" + ;; + ?) + echo "Unexpected argument flag: $opt" > $ERR + exit 1 + ;; + esac +done + +if [ ${search} -lt 0 || ${search} -gt 5 ]; then + echo "Invalid search configuration: ${search}" > $ERR + exit 1 +fi +# Handle arguments for optimization +if [ ${search} -ge 3 ]; then + if [ ! ${cost_min} ]; then + args+=" -C" + fi + args+=" -w ${weight}" + if [ "${bound}x" != "x" ]; then + args+=" -b ${bound}" +fi + shift 2 -$FF -o $DOMAIN -f $PROBLEM $@ > $OUT 2>$ERR +$FF ${args} > $OUT 2>$ERR # Getting plan grep '[0-9]:' $OUT | cut -d : -f 2- | \ awk '{$1=$1;print}' | \