Wednesday, November 29, 2006

Debugging TK Procedure Functions

Here are some ways to debug TK procedures that may not be generating the results you expect.

1. Use TK's DEBUG function. Insert a line in your procedure with a call to DEBUG. DEBUG reports the values of the expressions you include as its arguments. For example,

call DEBUG(i,x,cos(x*y))

When TK processes this statement, it pauses and displays the values of variables i and x as well as the cos function expression. If a value is not available, TK displays ??? instead. When you click ok to continue, TK continues processing the model and may run into the same statement again. TK displays the current values each time.

2. Insert a "bad" statement to trigger an error at a specific location. This trick is useful for determining where TK goes or has been. In some procedures, you may have programmed the logic such that some statements simply get skipped. To test this, insert a statement such as y = SQRT(-1) which will always stop TK. Keep moving it around until it's clear where your logic is leading TK astray.

3. In combination with the previous trick, use the Examine Command after TK generates an error. This is useful for learning what the last values were of local variables in functions prior to stopping for the error.

These tips can also be useful on the Rule Sheet but are more appropriate for procedure functions which follow a logical sequence. TK makes repeated passes through the rule sheet to solve the rules. Each pass will trigger a call to a DEBUG function used there. The Tracer Log and Solution Tracer Report are better options for understanding TK's journey through the rules.

Drop me a line if you find this useful.

- Todd
(todd@uts.com)

Friday, November 10, 2006

Updated TK Training and Materials

TK5 Basic Training has been updated to include all the new features of the software. The web site includes the new training document. It's now 66 pages. You'll see that the TK/Excel Toolkit gets a lot more attention. An introduction to the variety of different solvers has been greatly expanded.

I've been doing TK Training for 20 years and the Basic class has always been an intense one-day session. You basically learn a programming language in a day. Fortunately, TK is so well structured that it's mostly a matter of learning how to create and combine objects. The hardest part I suppose is choosing the best approach to take in solving a problem, because there are usually several valid paths. Do I list solve or create a function? Do I use the Iterative Solver or the Optimizer?

The recent trend is to handle training in a series of short web-based sessions using Live Meeting. If you haven't had a Live Meeting session with us yet, give it a try. We can set one up at a moment's notice in most cases. I use them for tech calls too. I get the biggest kick from users of TK4 who never upgraded to TK5 and see it in a Live Meeting. The response is usually something like "Why didn't you tell me I could have been doing that?" Hey, TK can do so much more than most people think it can... and it's not hard to learn. Call us for training or a Live Meeting and get caught up!

amazing 

counters
Dell Computer Deals