help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] glpsol exit codes (was: a suggestion concerning a new option


From: Robbie Morrison
Subject: [Help-glpk] glpsol exit codes (was: a suggestion concerning a new option)
Date: Mon, 22 Feb 2010 16:38:51 +0100
User-agent: Thunderbird 1.5.0.14ubu (X11/20080306)

Hello glpsol users, Andrew, Pietro Scionti

Andrew suggested calling 'glpsol' from a script (see
below for his posting).

In which case, interpreting the exit status from
'glpsol' could be helpful.

However, the chapter on 'glpsol' in the GLPK manual
does not mention exit codes.  Neither does "glpsol
--help".

I therefore wonder if 'glpsol' does provide exit
information of any kind -- even relatively coarse
information.  If so, this might simplify the writing of
bash shell scripts (assuming version 3 here).  For
instance, for the purpose of discussion:

  stub="$1                     # first argument
  stub=${stub%.mod}            # strip extension if given
  model=$stub.mod              # add extension
  test -f "$model" || ...      # confirm file
  glpsol --model "$model" 1>/dev/null
  ret=$?                       # capture exit status
  case "$ret" in
    0) ... ;;
    1) ... ;;
    *) ... ;;
  esac

Another approach would be to capture the screen output
and search for predetermined strings using 'grep' and
similar utilities.  For example:

  stdout=$(glpsol --model "$model" 2>/dev/null)
  if grep --quiet "pattern" <<< "$stdout"; then
    ...
  fi

Or read the output files and similarly hunt for known
strings.

If 'glpsol' does have informative exit codes, I would
be happy to mark these up in texinfo or LaTeX for
inclusion in the GLPK manual.

For an excellent PDF on bash scripting, search the web
for the following (and pick the latest version):

  Cooper, Mendel.  Advanced bash-scripting guide : an
  in-depth exploration of the art of shell scripting.

with best wishes
Robbie Morrison

> ------------------------------------------------------------
> To:          Andrew Makhorin <address@hidden>
> Subject:     R: R: R: [Help-glpk] A suggestion concerning a new option
> From:        Pietro Scionti <address@hidden>
> Date:        Wed, 17 Feb 2010 10:51:10 +0100
> ------------------------------------------------------------
>
> Yes, that seems to do just right! Thank you so much,
> Andrew!
>
> If anybody still wants my edited source files, so they
> can take inspiration for something like what I was
> trying to do, I can upload them here.
> ________________________________________
> Da: Andrew Makhorin address@hidden
> Inviato: martedì 16 febbraio 2010 11.01
> A: Pietro Scionti Cc: Antti-L; address@hidden
> Oggetto: Re: R: R: [Help-glpk] A suggestion concerning a new option
>
>> > Yes, that is what I want. But Andrew's suggestion counts two different
>> > steps:
>> > a) run glpsol with options -m problem.mod -w problem.out --nomip
>> > b) run glpsol with options -m problem.mod --nointopt --ini problem.out
>> > Am I wrong, Andrew?
>
> No, you are right.
>
>> > Someone is required to be there to pass from a) to b), namely to
>> > type the command and run it. Or can you schedule a command line task
>> > to be automatically executed after a first one finishes?
>
> Why not to use a script?
>
> Archimede S.r.l.
> Sede Legale:
> Via Manzoni, 82
> Ponte S. Giovanni
>
> Sede Operativa e Amministrativa:
> Via Settevalli, 133/v
> 06128 Perugia
>
> P.IVA: 01992020543
>
> Tel.  075 515 22 11
> Fax. 075 515 22 99
> www.archinet.it

---
Robbie Morrison
PhD student -- policy-oriented energy system simulation
Technical University of Berlin (TU-Berlin), Germany
University email (redirected) : address@hidden
Webmail (preferred)           : address@hidden
[from IMAP client]







reply via email to

[Prev in Thread] Current Thread [Next in Thread]