Changeset 508


Ignore:
Timestamp:
Feb 15, 2011 4:52:44 PM (9 years ago)
Author:
pbelotti
Message:

making the whole Couenne independent of rusage (this time seriously...)

Location:
trunk/Couenne/src
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/branch/Nauty.cpp

    r490 r508  
    1616#include <map>
    1717#include <set>
    18 #include <sys/time.h>
    19 #include <sys/resource.h>
     18#include "CoinTime.hpp"
    2019//#include "OrbitalOptions.h"
    2120//extern OrbitalOptions *options;
     
    138137  //  if (autoComputed_) return;
    139138
    140   struct rusage usage;
    141   getrusage(RUSAGE_SELF, &usage);
    142   struct timeval t = usage.ru_utime;
    143   double startCPU = (double) t.tv_sec + ((double)t.tv_usec * 1e-6);
     139  double startCPU = CoinCpuTime ();
    144140
    145141  options_->defaultptn = FALSE;
     
    177173  autoComputed_ = true;
    178174
    179   getrusage(RUSAGE_SELF, &usage);
    180   t = usage.ru_utime;
    181   double endCPU = (double) t.tv_sec + ((double)t.tv_usec * 1e-6);
     175  double endCPU = CoinCpuTime ();
    182176
    183177  nautyCalls_++;
     
    256250}
    257251
    258    
    259 
    260 
    261 
    262 
    263 
    264 
    265 
    266 
    267252/*
    268253bool
  • trunk/Couenne/src/sdpcuts/CouenneSdpCuts.hpp

    r349 r508  
     1/* $Id$
     2 *
     3 * Name:    CouenneSdpCuts
     4 * Author:  Pietro Belotti
     5 * Purpose: wrapper for Couenne to insert sdpcuts
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef CouenneSdpCuts_hpp
    211#define CouenneSdpCuts_hpp
  • trunk/Couenne/src/sdpcuts/CutGen.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    CutGen.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose: Generation of all cust
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include "stdlib.h"
    211#include "stdio.h"
    312#include "math.h"
    4 #include "sys/time.h"
    5 #include "sys/resource.h"
     13#include "CoinTime.hpp"
    614
    715#include "CutGen.hpp"
     
    403411        for (int i=0; i<SPARSIFY_MAX_CARD; i++)
    404412                sparse_v_mat2[i] = new double[np];
    405         struct rusage use;
    406413
    407414        OsiSolverInterface *sirlt = si.clone(true);
     
    437444        double time1 = 0,starttime1 = 0;
    438445
    439         getrusage (RUSAGE_SELF, &use);
    440         starttime1 = use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec;
     446        starttime1 = CoinCpuTime ();
     447
     448
    441449        int gencuts1 = 0;
    442450        OsiCuts cs1;
     
    461469                }
    462470        }
    463         getrusage (RUSAGE_SELF, &use);
    464471
    465472        int decomposition_counter1 = decomposition_counter;
    466473
    467         time1 = fabs(use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec - starttime1);
     474        time1 = CoinCpuTime () - starttime1;
    468475        double time_per_cut1 = time1 / gencuts1;
    469476        int dupcuts1 = gencuts1 - cs1.sizeRowCuts();
     
    471478
    472479        OsiSolverInterface *si1_lp = si.clone(true);
    473         getrusage (RUSAGE_SELF, &use);
    474         double starttime1_lp = use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec;
     480        double starttime1_lp = CoinCpuTime ();
    475481        si1_lp->applyCuts (cs1);
    476482        si1_lp->resolve();
    477         getrusage (RUSAGE_SELF, &use);
    478         double time1_lp = fabs(use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec - starttime1_lp);
     483        double time1_lp = CoinCpuTime () - starttime1_lp;
    479484        double obj1 = si1_lp->getObjValue() + objConst_;
    480485
    481486        OsiSolverInterface *si1_lporigcuts = si.clone(true);
    482         getrusage (RUSAGE_SELF, &use);
    483         double starttime1_lporigcuts = use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec;
     487        double starttime1_lporigcuts = CoinCpuTime ();
    484488        si1_lporigcuts->applyCuts(cs_origev);
    485489        si1_lporigcuts->applyCuts(cs1);
    486490        si1_lporigcuts->resolve();
    487         getrusage (RUSAGE_SELF, &use);
    488         double time1_lporigcuts = fabs(use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec - starttime1_lporigcuts);
     491        double time1_lporigcuts = CoinCpuTime () - starttime1_lporigcuts;
    489492        double obj1_withorigev = si1_lporigcuts->getObjValue() + objConst_;
    490493
     
    525528        double time2 = 0,starttime2 = 0;
    526529
    527         getrusage (RUSAGE_SELF, &use);
    528         starttime2 = use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec;
     530        starttime2 = CoinCpuTime ();
    529531        int gencuts2 = 0;
    530532        OsiCuts cs2;
     
    549551                }
    550552        }
    551         getrusage (RUSAGE_SELF, &use);
    552553
    553554        int decomposition_counter2 = decomposition_counter;
    554555
    555         time2 = fabs(use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec - starttime2);
     556        time2 = CoinCpuTime () - starttime2;
    556557        double time_per_cut2 = time2 / gencuts2;
    557558        int dupcuts2 = gencuts2 - cs2.sizeRowCuts();
    558559        double dupcuts_perc2 = (100.0 * ((double) dupcuts2)) / ((double)gencuts2);
    559560        OsiSolverInterface *si2_lp = si.clone(true);
    560         getrusage (RUSAGE_SELF, &use);
    561         double starttime2_lp = use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec;
     561        double starttime2_lp = CoinCpuTime ();
    562562        si2_lp->applyCuts (cs2);
    563563        si2_lp->resolve();
    564         getrusage (RUSAGE_SELF, &use);
    565         double time2_lp = fabs(use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec - starttime2_lp);
     564        double time2_lp = CoinCpuTime () - starttime2_lp;
    566565        double obj2 = si2_lp->getObjValue() + objConst_;
    567566        OsiSolverInterface *si2_lporigcuts = si.clone(true);
    568         getrusage (RUSAGE_SELF, &use);
    569         double starttime2_lporigcuts = use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec;
     567        double starttime2_lporigcuts = CoinCpuTime ();
    570568        si2_lporigcuts->applyCuts(cs_origev);
    571569        si2_lporigcuts->applyCuts (cs2);
    572570        si2_lporigcuts->resolve();
    573         getrusage (RUSAGE_SELF, &use);
    574         double time2_lporigcuts = fabs(use.ru_utime.tv_sec + 1e-6 * use.ru_utime.tv_usec - starttime2_lporigcuts);
     571        double time2_lporigcuts = CoinCpuTime () - starttime2_lporigcuts;
    575572        double obj2_withorigev = si2_lporigcuts->getObjValue() + objConst_;
    576573
  • trunk/Couenne/src/sdpcuts/CutGen.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    CutGen.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose: utilities for sdpcuts
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef SDPCUTGEN2_HPP
    211#define SDPCUTGEN2_HPP
  • trunk/Couenne/src/sdpcuts/Heuristics.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    Heuristics.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <stdio.h>
    211#include <stdlib.h>
  • trunk/Couenne/src/sdpcuts/Heuristics.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    Heuristics.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef HEURISTICS_HPP
    211#define HEURISTICS_HPP
  • trunk/Couenne/src/sdpcuts/OsiXxxSolverInterface.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    OsiXxxSolverInterface.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef OSIXXXSOLVERINTERFACE_HPP
    211#define OSIXXXSOLVERINTERFACE_HPP
  • trunk/Couenne/src/sdpcuts/disjunctive_cuts.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    disjunctive_cuts.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <disjunctive_cuts.hpp>
    211
  • trunk/Couenne/src/sdpcuts/disjunctive_cuts.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    disjunctive_cuts.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef DISJUNCTIVE_CUTS_HPP
    211#define DISJUNCTIVE_CUTS_HPP
  • trunk/Couenne/src/sdpcuts/dsyevx_wrapper.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    dsyevx_rapper.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <stdlib.h>
    211#include <stdio.h>
    312#include <math.h>
    413
    5 #include <sys/time.h>
    6 #include <sys/resource.h>
    714#include <misc_util.hpp>
    815
  • trunk/Couenne/src/sdpcuts/dsyevx_wrapper.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    dsyevx_wrapper.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef DSYEVX_HPP
    211#define DSYEVX_HPP
  • trunk/Couenne/src/sdpcuts/linquad_cuts.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    linquad_cuts.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <linquad_cuts.hpp>
    211#include <stdio.h>
  • trunk/Couenne/src/sdpcuts/linquad_cuts.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    linquad_cuts.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef LINQUAD_CUTS_HPP
    211#define LINQUAD_CUTS_HPP
  • trunk/Couenne/src/sdpcuts/misc_util.cpp

    r507 r508  
    9292void Timer::start() {
    9393  _starttime = CoinCpuTime ();
    94   //    getrusage (RUSAGE_SELF, &_use);
    95   //    _starttime = _use.ru_utime.tv_sec + 1e-6 * _use.ru_utime.tv_usec;
    9694}
    9795
     
    102100                return fabs( _pausetimer->starttime() - _starttime );
    103101        }
    104         //      getrusage (RUSAGE_SELF, &_use);
    105         //      return fabs( (_use.ru_utime.tv_sec + 1e-6 * _use.ru_utime.tv_usec) - _starttime );
     102
    106103        return (fabs (CoinCpuTime () - _starttime));
    107104}
  • trunk/Couenne/src/sdpcuts/orthocut.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    orthocut.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <orthocut.hpp>
    211#include <CglCutGenerator.hpp>
  • trunk/Couenne/src/sdpcuts/orthocut.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    orthocut.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef ORTHOCUT_HPP
    211#define ORTHOCUT_HPP
     
    716#include <misc_util.hpp>
    817
    9 
    10 
    1118#define indexQ(i,j,n) ((n) + (i) * (2*(n)-1-(i)) / 2 + (j))
    1219
    13 
    14 
    15 
    16 
    1720void orthoCutGen(const double *sol, int n, OsiCuts &cs, double *z, double *w, int m, Tracer *tracer);
    18 
    19 
    20 
    21 
    22 
    2321
    2422#endif
  • trunk/Couenne/src/sdpcuts/populate.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    populate.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <stdio.h>
    211#include <string.h>
     
    1221int getSecondIdx(const char *colName);
    1322double _mul(double a, double b, double infinity);
    14 
    1523
    1624
  • trunk/Couenne/src/sdpcuts/populate.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    populate.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef POPULATE_HPP
    211#define POPULATE_HPP
     
    1221               int=-1, double=0, bool=false);
    1322
    14 int populateProblem (const char *filename,int *nptr, int *tptr, int *consptr, double **bptr, double **cptr, double ***Qptr, double *constantptr, double ***origmatptr, double **origrhsptr, char **origsenseptr, double **xlbptr,double **xubptr,double **ylbptr, double **yubptr,OsiSolverInterface *si);
    15 
     23int populateProblem (const char *filename,int *nptr, int *tptr, int *consptr, double **bptr,
     24                     double **cptr, double ***Qptr, double *constantptr, double ***origmatptr,
     25                     double **origrhsptr, char **origsenseptr, double **xlbptr,double **xubptr,
     26                     double **ylbptr, double **yubptr,OsiSolverInterface *si);
    1627
    1728#endif
  • trunk/Couenne/src/sdpcuts/quadratic_cuts_check.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    quadratic_cuts_check.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <quadratic_cuts_check.hpp>
    211#include <stdio.h>
  • trunk/Couenne/src/sdpcuts/quadratic_cuts_check.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    quadratic_cuts_check.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef QUADRATIC_CUTS_CHECK_HPP
    211#define QUADRATIC_CUTS_CHECK_HPP
     
    3847};
    3948
    40 
    4149#endif
    4250
  • trunk/Couenne/src/sdpcuts/report.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    report.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <stdio.h>
    211#include <stdlib.h>
  • trunk/Couenne/src/sdpcuts/report2.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    report2.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <stdio.h>
    211#include <stdlib.h>
  • trunk/Couenne/src/sdpcuts/rlt_cuts.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    rlt_cuts.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <stdio.h>
    211#include <string.h>
  • trunk/Couenne/src/sdpcuts/rlt_cuts.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    rlt_cuts.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef RLT_CUTS_HPP
    211#define RLT_CUTS_HPP
  • trunk/Couenne/src/sdpcuts/sdpcuts.cpp

    r487 r508  
    1 #include <sys/time.h>
    2 #include <sys/resource.h>
     1/* $Id$
     2 *
     3 * Name:    sdpcuts.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    310#include <stdio.h>
    411#include <stdlib.h>
  • trunk/Couenne/src/sdpcuts/sdpcuts.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    sdpcuts.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef SDPCUTS_HPP
    211#define SDPCUTS_HPP
  • trunk/Couenne/src/sdpcuts/sdpsol.cpp

    r487 r508  
    1 #include <sys/time.h>
    2 #include <sys/resource.h>
     1/* $Id$
     2 *
     3 * Name:    sdpsol.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    310#include <stdio.h>
    411#include <stdlib.h>
  • trunk/Couenne/src/sdpcuts/sedumi.cpp

    r487 r508  
    1 #include <sys/time.h>
    2 #include <sys/resource.h>
     1/* $Id$
     2 *
     3 * Name:    sedumi.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    310#include <stdio.h>
    411#include <stdlib.h>
  • trunk/Couenne/src/sdpcuts/tracer.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    tracer.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <sdpcuts.hpp>
    211#include <tracer.hpp>
  • trunk/Couenne/src/sdpcuts/tracer.hpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    tracer.hpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#ifndef TRACER_HPP
    211#define TRACER_HPP
  • trunk/Couenne/src/sdpcuts/tracerreport.cpp

    r487 r508  
     1/* $Id$
     2 *
     3 * Name:    tracerreport.cpp
     4 * Author:  Andrea Qualizza
     5 * Purpose:
     6 *
     7 * This file is licensed under the Eclipse Public License (EPL)
     8 */
     9
    110#include <stdio.h>
    211#include <stdlib.h>
Note: See TracChangeset for help on using the changeset viewer.