/[ascend]/trunk/ascend4/TK/Resolve.tcl
ViewVC logotype

Contents of /trunk/ascend4/TK/Resolve.tcl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download) (as text)
Fri Oct 29 20:54:12 2004 UTC (20 years, 4 months ago) by aw0a
File MIME type: text/x-tcl
File size: 2392 byte(s)
Setting up web subdirectory in repository
1 # Ben Allan, Livermore, California, Feb 10, 2004
2 # GPL
3 #
4 # This feature is not loaded in ascend by default,
5 # as it breaks the design of the GUI in fundamental ways--
6 # it deprives the interactive user of immediate feedback.
7 #
8 # A new script function to handle re-solving efficiently
9 # for QRSLV.
10 # This function can be used to re-solve a model already
11 # in the solver if and only if:
12 # 1) The model has been solved (at least partially) once.
13 # 2) The .fixed flags on variables and .included flags on relations
14 # have not been changed. (Thus the matrix structure is unchanged).
15 # 3) The choice of objective is not changed.
16 #
17 # We are allowed to change:
18 # Bounds on variables (.lower_bound, .upper_bound)
19 # Scaling values on variables (.nominal)
20 # Values of input variables (those with .fixed == true)
21 # Numerical solver controls like convergence tolerances.
22 #
23 # Side effects:
24 # This function updates Tcl variables related to the solver,
25 # but does not update the GUI. To update the GUI, one will
26 # have to hit the GUI Solve button or call the script SOLVE again.
27 #
28 # Unlike other solver processes, the tracing functions
29 # are not used, in the interest of speed. (entertrace, leavetrace
30 # commented out).
31 # The GUI interrupt is not going to work.
32 # The solver retains control for all iterations, with no tcl
33 # in between blocks.
34
35 #
36 # proc RESOLVE_NO_GUI {}
37 #----------------------------------------------------------------------------
38 # Execute resolve internals
39 #----------------------------------------------------------------------------
40 proc RESOLVE_NO_GUI {} {
41 # entertrace
42 if {![slv_checksys]} { return }
43 # needs better sanity checking and interrupt checking.
44 global ascSolvVect ascSolvStatVect ascSolv32767Vect ascSolv3Vect
45 set ascSolvStatVect(menubreak) 0
46 slv_set_haltflag 0
47 if {[slv_checksys]} {
48 set ascSolvStatVect(ready2solve) 1
49 }
50 Solve_Downdate_ParmBox
51 slv_resolve
52 slv_solve
53 Solve_Update_StatVect
54 puts "converged= $ascSolvStatVect(converged)"
55 puts "max err= $ascSolvStatVect(maxblockerr)"
56 #leavetrace
57 }
58
59 #
60 # Force an update of the gui
61 # after the resolve is all over.
62 #
63 proc RESOLVE_GUI {} {
64 RESOLVE_NO_GUI
65 Solve_Update_StatusBox 1
66 }
67
68 #
69 # Example of intended use (pseudo code):
70 # 1) SOLVE sim;
71 # 2) set someFixedVariable to a new value;
72 # RESOLVE_NO_GUI
73 # if {! $ascSolvStatVect(converged) } { die } else { do something else }

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