Using AMPL Studio |
|
Scripts, Debugging & Tracing in AMPL Studio
In AMPL studio we can include script file. Prominent among the unique advantages of AMPL studio are the debugging and tracing features. ScriptsIn Chapter 4, we have already seen the ways of running a script file. A new script file can be added to a project by right clicking on the script folder of any project or by choosing to add script file to an active project from the Add to project submenu under project-menu.
To run a script file for the project, the script file (.sa or .run) file first needs to be opened in AMPL Studio and then by use of it can be run.
Debugging and Tracing: step by step walk through example
We illustrate the debugging feature by use of an example. We consider the example ‘stoch’ present under AmplStudio Modeling System 1.6.J\Examples\Script.
1. We load the workspace Scriptworkspace.wampl and consider the project stoch.
2. We load the stoch.run file by double clicking on it.
3. The script file can be run in one go by using Start Debug Script -> Run script submenu under the Build menu or the button on the script bar.
4. To step through the script file use Start Debug Script -> Go submenu from the Build menu or the button from the script bar.
AMPL studio then steps through the script file.
5. When using step by step debugging feature (Step 4) to proceed a single step (analogous to AMPL’s step command) use Start Debug Script -> Step under Build menu or button on script bar
AMPL studio then processes one step at a time.
6. To step past a compound statement (analogous to AMPL’s next command) rather than into it, use Start Debug Script ->Next under Build menu or use button on the script bar.
AMPL studio then just steps past the compound statement (For loop in the screen shot)
7. To see the value of any variables or parameter double click on the variable or parameter name in the script file. AMPL studio displays its value in Output console as well as in the script file.
9. At any time to stop stepping through the script file use Start Debug Script > Stop under build menu or the button on the script bar.
AMPL studio processes the complete script file and displays the final results.
|
|
Copyright (c) 2012. Datumatic Ltd. Registration No. 04988675. UK. |