Difference: AMPLProcess (4 vs. 5)

Revision 52008-02-27 - MichaelOSullivan

Line: 1 to 1
 
META TOPICPARENT name="AMPLGuide"
Added:
>
>
<-- Ready to Review -->
 

The AMPL Process

Line: 15 to 16
  To start AMPL in Windows you simply start a command line application and type ampl.
Changed:
<
<
src="ampl.jpg"
>
>
ampl.jpg
  You will then be able to enter AMPL commands at the AMPL prompt.
Changed:
<
<
src="ampl_examples.jpg"
>
>
ampl_examples.jpg
  Return to top
Line: 49 to 50
  The AMPL model is input after switching to the (default) model environment, by typing model; and then using the include command to import the model file, or else typing in the commands for the AMPL model directly at the ampl: prompt.
Changed:
<
<
src="model_include.jpg"
>
>
model_include.jpg
  Alternatively, you can type model <filename>.mod;.
Changed:
<
<
src="model_file.jpg"
>
>
model_file.jpg
  Return to top
Line: 61 to 62
  All data and values specific to the problem instance you are solving are separated from the model formulation when using AMPL. This is enforced by the method used to input the problem details into AMPL - the model formulation is entered in the model environment, the problem specific data is entered in the data environment. To switch from the model environment to the data environment one types data; at the AMPL prompt ampl: (and switches back to the model environment by typing model;).
Changed:
<
<
src="model_data.jpg"
>
>
model_data.jpg
  As with entering the model formulation, it is common to store the data for a specific problem in a data file (<filename>.dat). This data is then imported while in data mode by using the include command, followed by the filename and a semicolon (or by typing the AMPL commands in directly).
Changed:
<
<
src="data_include.jpg"
>
>
data_include.jpg
  Again, one can use the alternative method of typing data <filename>.dat (which does not require a switch from the model environment).
Changed:
<
<
src="data_file.jpg"
>
>
data_file.jpg
  Return to top
Line: 86 to 87
  and you run this file using the include command.
Changed:
<
<
src="script_file.jpg"
>
>
script_file.jpg
 

Setting Data Dynamically

Line: 112 to 113
 let maxab := 4; # Syntax error, parameter defined by an expression display a, b, maxab;
Changed:
<
<
src="dynamic_error.jpg"
>
>
dynamic_error.jpg
  The previous example also showed how to use both the model and data environments in the same script file. Furthermore, rather than using model; to enter the model environment (and leave the data environment), it jumps from the data environment to the model environment by using a command that is not valid in the data environment (the display command).
Line: 124 to 126
  The easiest way to edit AMPL files is using a text editor such as Wordpad. To open Wordpad go to the start menu, select Programs, then Accessories and finally Wordpad
Changed:
<
<
src="run_wordpad.jpg"
>
>
run_wordpad.jpg
  When you have finished editing, save the file in the appropriate directory. Be sure to save your file as a basic text file *NOT* in Rich Text Format.
Changed:
<
<
src="save_ampl.jpg"
>
>
save_ampl.jpg
 

Running AMPL files

Line: 136 to 139
 
  1. Either starting a command line application or double-clicking on =setup_ampl.bat= (if you are at home);
  2. Navigating to the directory where you saved the files;
  3. Starting AMPL
Changed:
<
<
  1. Typing AMPL commands, e.g., model <modelname>.mod;, data <dataname>.dat;, =include <runname>.run;
>
>
  1. Typing AMPL commands, e.g., model <modelname>.mod;, data <dataname>.dat;, include <runname>.run;
  Return to top

-- MichaelOSullivan - 25 Feb 2008

Deleted:
<
<
  • ampl.jpg:
    ampl.jpg

  • ampl_examples.jpg:
    ampl_examples.jpg

  • model_include.jpg:
    model_include.jpg

  • model_file.jpg:
    model_file.jpg

  • model_data.jpg:
    model_data.jpg

  • data_include.jpg:
    data_include.jpg

  • data_file.jpg:
    data_file.jpg

  • script_file.jpg:
    script_file.jpg

  • dynamic_error.jpg:
    dynamic_error.jpg

  • run_wordpad.jpg:
    run_wordpad.jpg

  • save_ampl.jpg:
    save_ampl.jpg

  • run_wordpad.jpg:
    run_wordpad.jpg

  • ampl.jpg:
    ampl.jpg
 
META FILEATTACHMENT attachment="ampl.jpg" attr="h" comment="" date="1204098473" name="ampl.jpg" path="ampl.jpg" size="21033" stream="ampl.jpg" tmpFilename="" user="MichaelOSullivan" version="1"
META FILEATTACHMENT attachment="ampl_examples.jpg" attr="h" comment="" date="1204098502" name="ampl_examples.jpg" path="ampl_examples.jpg" size="21186" stream="ampl_examples.jpg" tmpFilename="" user="MichaelOSullivan" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback