Starting the First Time
We recommend that new FICO Xpress Optimizer users first try running the Console Optimizer 'optimizer' executable from the command prompt before using the other interfaces of Optimizer. This is because (i) it is the easiest way to confirm the license status of the installation and (ii) it is an introduction to a powerful tool with many uses during the development cycle of optimization applications. For this reason we focus mainly on discussing the Console Optimizer in this section as an introduction to various basic functions of the Optimizer.
Licensing
To run the Optimizer from any interface it is necessary to have a valid licence file, xpauth.xpr. The FICO Xpress licensing system is highly flexible and is easily configurable to cater for the user's requirements. The system can allow the Optimizer to be run on a specific machine, on a machine with a specific ethernet address or on a machine connected to an authorized hardware dongle.
If the Optimizer fails to verify a valid license then a message can be obtained that describes the reasons for the failure and the Optimizer will be unusable. When using the Console Optimizer the licensing failure message will be displayed on the console. Library users can call the function XPRSgetlicerrmsg to get the licensing failure message.
On Windows operating systems the Optimizer searches for the license file in the directory containing the installation's binary executables, which are installed by default into the c:\XpressMP\bin folder. On Unix systems the directory pointed to by the XPRESS environment variable is searched. Note that to avoid unnecessary licensing problems the user should ensure that the license file is always kept in the same directory as the FICO Xpress Licensing Library (e.g., xprl.dll on Windows).
Starting Console Optimizer
Console Optimizer is an interactive command line interface to the Optimizer. Console Optimizer is started from the command line using the following syntax:
C:\> optimizer [problem_name] [@filename]
From the command line an initial problem name can be optionally specified together with an optional second argument specifying a text "script" file from which the console input will be read as if it had been typed interactively.
Note that the syntax example above shows the command as if it were input from the Windows Command Prompt (i.e., it is prefixed with the command prompt string C:\>). For Windows users Console Optimizer can also be started by typing optimizer into the "Run ..." dialog box in the Start menu.
The Console Optimizer provides a quick and convenient interface for operating on a single problem loaded into the Optimizer. Compare this with the more powerful library interface that allows one or more problems to co–exist in a process. The Console Optimizer problem contains the problem data as well as (i) control variables for handling and solving the problem and (ii) attributes of the problem and its solution information.
Useful features of Console Optimizer include a help system, auto–completion of command names and integration of system commands.
Typing "help" will list the various options for getting help. Typing "help commands" will list available commands. Typing "help attributes" and "help controls" will list the available attributes and controls, respectively. Typing "help" followed by a command name or control/attribute name will list the help for this item. For example, typing "help lpoptimize" will get help for the LPOPTIMIZE command.
The Console Optimizer auto–completion feature is a useful way of reducing key strokes when issuing commands. To use the auto–completion feature, type the first part of an optimizer command name followed by the Tab key. For example, by typing "lpopt" followed by the Tab key Console Optimizer will complete to the LPOPTIMIZE command. Note that once you have finished inputting the command name portion of your command line, Console Optimizer can also auto–complete on file names. For example, if you have a matrix file named hpw15.mps in the current working directory then by typing "readprob hpw" followed by the Tab key the command should auto–complete to the string "readprob hpw15.mps". Note that the auto–completion of file names is case–sensitive.
Console Optimizer also features integration with the operating system's shell commands. For example, by typing "dir" (or "ls" under Unix) you will directly run the operating system's directory listing command. Using the "cd" command will change the working directory, which will be indicated in the prompt string:
[xpress bin] cd \ [xpress C:\]
Finally, note that when the Console Optimizer is first started it will attempt to read in an initialization file named optimizer.ini from the current working directory. This is an ASCII file that may contain any lines that can normally be entered at the console prompt, such as commands or control parameter settings. The lines of the optimizer.ini file are run with at start up, and can be useful for setting up a customized default Console Optimizer environment for the user (e.g., defining custom controls settings on the Console Optimizer problem).
Scripting Console Optimizer
The Console Optimizer interactive command line hosts a TCL script parser (http://www.tcl.tk). With TCL scripting the user can program flow control into their Console Optimizer scripts. Also TCL scripting provides the user with programmatic access to a powerful suite of functionality in the TCL library. With scripting support the Console Optimizer provides a high level of control and flexibility well beyond that which can be achieved by combining operating system batch files with simple piped script files. Indeed, with scripting support, Console Optimizer is ideal for (i) early application development, (ii) tuning of model formulations and solving performance and (iii) analyzing difficulties and bugs in models.
Note that the TCL parser has been customized and simplified to handle intuitive access to the controls and attributes of the Optimizer. The following example shows how to proceed with write and read access to the MIPLOG Optimizer control:
[xpress C:\] miplog=3 [xpress C:\] miplog 3
The following shows how this would usually be achieved using TCL syntax:
[xpress C:\] set miplog 3 3 [xpress C:\] $miplog 3
The following set of examples demonstrate how with some simple TCL commands and some basic flow control constructs the user can quickly and easily create powerful programs.
The first example demonstrates a loop through a list of matrix files where a simple regular expression on the matrix file name and a simple condition on the number of rows in the problem decide whether or not the problem is solved using lpoptimize. Note the use of:
- the creation of a list of file names using the TCL glob command
- the use of the TCL square bracket notation ([]) for evaluating commands to their string result value
- the TCL foreach loop construct iterating over the list of file names
- dereferencing the string value of a variable using '$'
- the use of the TCL regexp regular expression command
- the two TCL if statements and their condition statements
- the use of the two Optimizer commands READPROB and MINIM
- the TCL continue command used to skip to the next loop iteration
set filelist [glob *.mps] foreach filename $filelist { if { [regexp -all {large_problem} $filename] } continue readprob $filename if { $rows > 200 } continue lpoptimize }
The second example demonstrates a loop though some control settings and the tracking of the control setting that gave the best performance. Note the use of:
- the TCL for loop construct iterating over the values of variable i from –1 to 3
- console output formatting with the TCL puts command
- setting the values of Optimizer controls CUTSTRATEGY and MAXNODE
- multiple commands per line separated using a semicolon
- use of the MIPSTATUS problem attribute in the TCL if statement
- comment lines using the hash character '#'
set bestnodes 10000000 set p hpw15 for { set i -1 } { $i <= 3 } { incr i } { puts "Solving with cutstrategy : $i" cutstrategy=$i; maxnode=$bestnodes readprob $p mipoptimize if { $mipstatus == 6 } { # Problem was solved within $bestnodes set bestnodes $nodes; set beststrat $i } } puts "Best cutstrategy : $beststrat : $bestnodes"
Interrupting Console Optimizer
Console Optimizer users may interrupt the running of the commands (e.g., lpoptimize) by typing Ctrl–C. Once interrupted Console Optimizer will return to its command prompt. If an optimization algorithm has been interrupted in this way, any solution process will stop at the first 'safe' place before returning to the prompt. Optimization iterations may be resumed by re–entering the interrupted command. Note that by using this interrupt–resume functionality the user has a convenient way of dynamically changing controls during an optimization run.
When Console Optimizer is being run with script input then Ctrl–C will not return to the command prompt and the Console Optimizer process will simply stop.
Lastly, note that "typing ahead" while the console is writing output to screen can cause Ctrl–C input to fail on some operating systems.
© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.