Try our new documentation site (beta).
The params argument
As mentioned previously, the Gurobi optimizer provides a set of parameters that allow you to control many of the details of the optimization process. Factors like feasibility and optimality tolerances, choices of algorithms, strategies for exploring the MIP search tree, etc., can be controlled by modifying Gurobi parameters before beginning the optimization.
Parameter changes are specified using a list variable having multiple named components, which is passed as an argument to the appropriate Gurobi function (e.g., gurobi). The name of each named component must be the name of a Gurobi parameter, and the associated value should be the desired value of that parameter. You can find a complete list of the available Gurobi parameters in the reference manual.
To create a list that would set the Gurobi
Method parameter to 2 and the
ResultFile parameter to
model.mps, you would do the following:
params <- list()
params$Method <- 2
params$ResultFile <- 'model.mps'
We should say a bit more about the ResultFile parameter. If this parameter is set, the optimization model that is eventually passed to Gurobi will also be output to the specified file. The filename suffix should be one of .mps, .lp, .rew, .rlp, .dua, or.dlp, to indicate the desired file format (see the file format section in the reference manual for details on Gurobi file formats).
The params struct can also be used to set license specific parameters, that define the computational environment to be used. We will discuss the two most common use cases next, and refer again to the collection of all available parameters in the reference manual.
Using a Compute Server License
Gurobi Compute Server allows you to offload optimization jobs to a remote server. Servers are organized into clusters. By providing the name of any node within the cluster, your job will automatically be sent to the least heavily loaded node in the cluster. If all nodes are at capacity, your job will be placed in a queue, and will proceed once capacity becomes available. You can find additional information about Gurobi Compute Server in the Gurobi Remote Services Reference Manual. The most commonly used parameters are the following.
- ComputeServer
- A Compute Server. You can refer to the server
using its name or its IP address. If you are using a non-default
port, the server name should be followed by the port number (e.g.,
server1:61000).
- ServerPassword (optional)
- User password on the Compute Server
cluster. Obtain this from your Compute Server administrator.
- CSPriority (optional)
- The priority of the job. Priorities must
be between -100 and 100, with a default value of 0 (by convention).
Higher priority jobs are chosen from the server job queue before lower
priority jobs. A job with priority 100 runs immediately, bypassing
the job queue and ignoring the job limit on the server. You should
exercise caution with priority 100 jobs, since they can severely
overload a server, which can cause jobs to fail, and in extreme cases
can cause the server to crash.
- CSRouter (optional)
- The router for the Compute Server cluster. A
router can be used to improve the robustness of a Compute Server
deployment. You can refer to the router using either its name or its
IP address. A typical Remote Services deployment won't use a router,
so you typically won't need to set this.
- CSTLSinsecure (optional)
- Indicates whether to use insecure mode in the TLS (Transport Layer Security). Set this to 0 unless your server administrator tells you otherwise.
Here is an example of how to use a params argument to connect
to a Compute Server:
params <- list()
params$ComputeServer <- 'server1.mycompany.com:61000'
params$CSPriority <- 5
Using a Gurobi Instant Cloud License
Gurobi Instant Cloud allows you to offload optimization jobs to a Gurobi Compute Server on the cloud. If an appropriate machine is already running, the job will run on that machine. It will automatically launch a new machine otherwise. Note that launching a new machine can take a few minutes. You can find additional information about the Gurobi Instant Cloud service in the reference manual. The most commonly used parameters are the following.
- CloudAccessID
- The access ID for your Gurobi Instant Cloud license.
This can be retrieved from the Gurobi Instant Cloud website. When
used in combination with your CloudSecretKey, this allows you
to launch Instant Cloud instances and submit jobs to them.
- CloudSecretKey
- The secret key for your Gurobi Instant Cloud license.
This can be retrieved from the Gurobi Instant Cloud website. When
used in combination with your CloudAccessID, this allows you to
launch Instant Cloud instances and submit jobs to them. Note that you
should keep your secret key private.
- CloudPool (optional)
- The machine pool. Machine pools allow you to
create fixed configurations on the Instant Cloud website (capturing
things like type of machine, geographic region, etc.), and then launch
and share machines from client programs without having to restate
configuration information each time you launch a machine. If not
provided, your job will be launched in the default pool associated
with your cloud license.
- CSPriority (optional)
- The priority of the job. Priorities must be between -100 and 100, with a default value of 0 (by convention). Higher priority jobs are chosen from the server job queue before lower priority jobs. A job with priority 100 runs immediately, bypassing the job queue and ignoring the job limit on the server. You should exercise caution with priority 100 jobs, since they can severely overload a server, which can cause jobs to fail, and in extreme cases can cause the server to crash.
Here is an example of how to use a params argument to launch a
Gurobi Instant Cloud instance:
params <- list()
params$CloudAccessID <- '3d1ecef9-dfad-eff4-b3fa'
params$CloudSecretKey <- 'ae6L23alJe3+fas'