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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 315 - (show annotations) (download) (as text)
Thu Feb 23 07:40:47 2006 UTC (18 years, 4 months ago) by johnpye
File MIME type: text/x-python
File size: 706 byte(s)
Expanded the python solver reporter a little
Added detection of newer SWIG versions that can optimise (-O)
1 import ascend
2 import time
3
4 class PythonSolverReporter(ascend.SolverReporter):
5 def __init__(self):
6 print "SOLVER REPORTER ---- PYTHON"
7 self.solvedvars = 0;
8 self.updateinterval = 0.1;
9 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):
16 _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

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