Ignore:
Timestamp:
Dec 19, 2010 11:42:58 PM (11 years ago)
Author:
tkr
Message:

Updates to scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/scripts/run_cbc.sh

    r1540 r1555  
    1 #!/usr/bin/env bash
    21#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    32#*                                                                           *
     
    54#*                                                                           *
    65#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     6# $Id: run_cbc.sh,v 1.1 2010/12/09 22:22:28 bzfheinz Exp $
    77
    88SOLVER=$1
    9 LPS=$2
     9BINNAME=$2
    1010NAME=$3
    1111TIMELIMIT=$4
    1212SOLFILE=$5
    13 MIPGAP=$6
     13THREADS=$6
     14MIPGAP=$7
    1415
    15 $SOLVER -import $NAME -sec $TIMELIMIT -ratio $MIPGAP -solve -solution $SOLFILE
     16TMPFILE=results/check.$SOLVER.tmp
     17
     18if test $THREADS != 0
     19then
     20    $BINNAME -import $NAME -sec $TIMELIMIT -threads $THREADS -ratio $MIPGAP -solve -solution $SOLFILE
     21else
     22    $BINNAME -import $NAME -sec $TIMELIMIT -ratio $MIPGAP -solve -solution $SOLFILE
     23fi
    1624
    1725if test -f $SOLFILE
    1826then
    19     # translate SCIP solution format into format for solution checker.
     27    # translate CBC solution format into format for solution checker.
    2028    #  The SOLFILE format is a very simple format where in each line
    2129    #  we have a <variable, value> pair, separated by spaces.
     
    2331    #  of the solution, as computed by the solver. A variable name of
    2432    #  =infeas= can be used to indicate that an instance is infeasible.
    25     awk -f parse_cbc_sol.awk $SOLFILE
     33    awk '
     34    BEGIN{
     35        infeasible = 0;
     36        nointsol = 0;
     37    }
     38    ($3 != "objective" && $3 != "gap" && $3 != "time" && $2 != "infeasible"){
     39        if (!infeasible){
     40                printf ("%s %s \n", $2, $3);
     41            }
     42    }
     43    ($3 == "objective" && $1 != "Infeasible" && $2 != "infeasible"){
     44        printf ("=obj= %s \n", $5);
     45    }
     46    ($3 == "gap"){
     47        printf ("=obj= %s \n", $8);
     48    }
     49    ($3 == "time"){
     50        if ($5 == "integer"){
     51           printf ("=nointsol= \n");
     52           nointsol = 1;
     53        }else{
     54           printf ("=obj= %s \n", $7);
     55        }
     56    }   
     57    ($1 == "Infeasible" || $2 == "infeasible"){
     58        printf ("=infeas= \n");
     59        infeasible = 1;
     60    }' $SOLFILE | tee $TMPFILE
     61    mv $TMPFILE $SOLFILE
    2662fi
    27 
    28 
Note: See TracChangeset for help on using the changeset viewer.