Ignore:
Timestamp:
Jan 24, 2010 4:06:15 PM (10 years ago)
Author:
jwatson
Message:

Added a _report_timing attribute to the base solver class. If true, it will print out presolve/solve/postsolve timing statistics. The derived shell-based solver will additionally report log and solution file read times.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.opt/trunk/coopr/opt/solver/shellcmd.py

    r1987 r2167  
    2323import pyutilib.plugin.core
    2424import pyutilib.misc
     25
     26import time
    2527
    2628class SystemCallSolver(OptSolver):
     
    175177        Process the output files.
    176178        """
     179        start_time = time.time()
    177180        if self._results_format is None:
    178181           raise ValueError, "Results format is None"
    179182        results = self.process_logfile()
     183        log_file_completion_time = time.time()
     184        if self._report_timing is True:
     185           print "Log file read time="+str(log_file_completion_time - start_time)+" seconds"
    180186        if self.results_reader is None:
    181187           self.process_soln_file(results)
     188           soln_file_completion_time = time.time()
     189           if self._report_timing is True:           
     190              print "Solution file read time="+str(soln_file_completion_time - log_file_completion_time)+" seconds"           
    182191        else:
    183192           results = self.results_reader(self.results_file, res=results)
     193           results_reader_completion_time = time.time()
     194           print "Results reader time="+str(results_reader_completion_time - log_file_completion_time)+" seconds"                     
    184195        if rc != None:
    185196           results.solver.error_rc=rc
Note: See TracChangeset for help on using the changeset viewer.