Error in target-runner.bat

29 views
Skip to first unread message

luciano...@aluno.ufop.edu.br

unread,
Sep 23, 2022, 8:34:43 AM9/23/22
to The irace package: Iterated Racing for Automatic Configuration
Hi irace team!




My name is Luciano and I'm a master student at Universidade Federal de Ouro Preto. I am studying the schedulling jobs problem and will use the BRKGA to resolve it. To parameterize I pretend to use the irace, but some problems are coming up and now I came across one that I can't solve myself.
The execution of the target-runner.bat can't recognize the executable of my code, but when i run it from command prompt it runs without errors. Follow the target-runner.bat:


#!/bin/bash
###############################################################################
# This script is the command that is executed every run.
# Check the examples in examples/
#
# This script is run in the execution directory (execDir, --exec-dir).
#
# PARAMETERS:
# %1 is the candidate configuration number
# %2 is the instance ID
# %3 is the seed
# %4 is the instance name
# The rest (%* after `shift 4') are parameters to the run
#
# RETURN VALUE:
# This script should print one numerical value: the cost that must be minimized.
# Exit with 0 if no error, with 1 in case of error
###############################################################################

#@echo off

# Please change the path to the correct one
EXE=cmake-build-debug/brkga-sjp
FIXED_PARAMS=" --tries 1 --time 10 --quiet "

CANDIDATE="$1"
INSTANCE_ID="$2"
SEED="$3"
INSTANCE="$4"
shift 4 || error "Not enough parameters."

CANDIDATE_PARAMETERS=$*

STDOUT=c${CANDIDATE}-${INSTANCE_ID}.stdout
STDERR=c${CANDIDATE}-${INSTANCE_ID}.stderr

#if not exist %exe% error "%exe%: not found or not executable (pwd: %(pwd))"

# If the program just prints a number, we can use 'exec' to avoid
# creating another process, but there can be no other commands after exec.
#exec %exe %FIXED_PARAMS% -i %instance %candidate_parameters%
# exit 1
#
# Otherwise, save the output to a file, and parse the result from it.
# (If you wish to ignore segmentation faults you can use '{}' around
# the command.)
$EXE ${FIXED_PARAMS} -i ${INSTANCE} --seed ${CANDIDATE_PARAMETERS}

#if %errorlevel% neq 0 exit /b %errorlevel%

# # This may be used to introduce a delay if there are filesystem
# # issues.
# SLEEPTIME=1
# while [ ! -s "%stdout%" ]; do
#     sleep %SLEEPTIME
#     let "SLEEPTIME += 1"
# done
#
# This is an example of reading a number from the output.
# It assumes that the objective value is the first number in
# the first column of the last line of the output.

#if exist %stdout% (

    #SETLOCAL EnableDelayedExpansion
    #SET "CMD=findstr /R /N "^^" %STDOUT% | find /C ":""
    COST=$(cat ${STDOUT} | grep -o -E 'Best [-+0-9.e]+' | cut -d ' ' -f2)
    echo "$COST"

    #echo %CMD%

    #del %stdout% %stderr%
   
    exit 0
   
#) ELSE (

    #exit /b
#)

After to run it, is presented the following message:
target error.jpg


Can someone help me? I would be really grateful.



Best regards.

Luciano Alves Corrêa
Mestrando em Engenharia de Produção
UFOP

Manuel López-Ibáñez

unread,
Sep 23, 2022, 9:24:31 AM9/23/22
to The irace package: Iterated Racing for Automatic Configuration
Hi,

You should base your target-runner on the template for linux not the one for Windows. Also, your template is quite old. Compared with this one: https://github.com/MLopez-Ibanez/irace/blob/master/inst/templates/target-runner.tmpl

The problem is that target-runner cannot find your executable "cmake-build-debug/brkga-sjp". You'll see that the template in github has this check:

if [ ! -x "${EXE}" ]; then
    error "${EXE}: not found or not executable (pwd: $(pwd))"
fi

to give a clearer error.

You say that "cmake-build-debug/brkga-sjp" runs without error when running outside target-runner. If so, my guess is that you are running "cmake-build-debug/brkga-sjp" from a directory different than the one used by target-runner. Notice that target-runner runs on the execDir (--exec-dir).

If the problem persists, then try replacing:

$EXE ${FIXED_PARAMS} -i ${INSTANCE} --seed ${CANDIDATE_PARAMETERS}

with:

echo "$EXE ${FIXED_PARAMS} -i ${INSTANCE} --seed ${CANDIDATE_PARAMETERS}"

to see what is exactly executed by irace and try to execute that from the command prompt.

There is another issue. You don't seem to be saving anything to the file in $STDOUT but you read from it later.

I would also recommend to run first with "--check" to catch these problems earlier.

I hope the above helps.

Manuel.
Reply all
Reply to author
Forward
0 new messages