/[ascend]/trunk/pygtk/interface/solverreporter.py
ViewVC logotype

Diff of /trunk/pygtk/interface/solverreporter.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 314 by johnpye, Thu Feb 23 06:00:42 2006 UTC revision 315 by johnpye, Thu Feb 23 07:40:47 2006 UTC
# Line 1  Line 1 
1  import ascend  import ascend
2    import time
3    
4  class PythonSolverReporter(ascend.SolverReporter):  class PythonSolverReporter(ascend.SolverReporter):
5      def __init__(self):      def __init__(self):
6          print "SOLVER REPORTER ---- PYTHON"          print "SOLVER REPORTER ---- PYTHON"
7            self.solvedvars = 0;
8            self.updateinterval = 0.1;
9          ascend.SolverReporter.__init__(self)          ascend.SolverReporter.__init__(self)
10            _time = time.clock();
11            self.startime = _time;
12            self.lasttime = _time;
13            print "Start time = ",self.lasttime
14    
15      def report(self,status):      def report(self,status):
16          print "Reporting (python)",status.getIterationNum()          _solvedvars = status.getNumConverged();
17            _time = time.clock();
18            _sincelast = _time - self.lasttime
19            if _sincelast > self.updateinterval:
20                if _solvedvars > self.solvedvars:
21                    print "Solved %d vars" % _solvedvars
22                    self.solvedvars = _solvedvars
23    
24                print "Iteration ",status.getIterationNum()
25                self.lasttime = _time;
26          return 0          return 0

Legend:
Removed from v.314  
changed lines
  Added in v.315

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22