|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgurobi.GRBEnv
public class GRBEnv
Gurobi environment object. Gurobi models are always associated with an environment. You must create an environment before can you create and populate a model. You will generally only need a single environment object in your program.
The methods on environment objects are mainly used to manage Gurobi
parameters (e.g., get
, getParamInfo
, set
).
While the Java garbage collector will eventually collect an unused
GRBEnv
object, an environment will hold onto resources (Gurobi
licenses, file descriptors, etc.) until that collection occurs. If
your program creates multiple GRBEnv
objects, we recommend
that you call GRBEnv.dispose
when you are done
using one.
Constructor Summary | |
---|---|
GRBEnv()
Create a Gurobi environment (with logging disabled). |
|
GRBEnv(boolean empty)
|
|
GRBEnv(java.lang.String logFileName)
Create a Gurobi environment (with logging enabled). |
|
GRBEnv(java.lang.String s0,
java.lang.String s1,
java.lang.String s2,
int i1,
java.lang.String s3)
|
|
GRBEnv(java.lang.String logfilename,
java.lang.String accessID,
java.lang.String secretKey,
java.lang.String pool,
int priority)
Create a Gurobi environment on Gurobi Instant Cloud. |
|
GRBEnv(java.lang.String logFileName,
java.lang.String computeServer,
java.lang.String router,
java.lang.String password,
java.lang.String group,
int tlsInsecure,
int priority,
double timeout)
Create a client Gurobi environment on a compute server. |
Method Summary | |
---|---|
void |
dispose()
Release the resources associated with a GRBEnv object. |
protected void |
finalize()
|
double |
get(GRB.DoubleParam param)
Query the value of a double-valued parameter. |
int |
get(GRB.IntParam param)
Query the value of an int-valued parameter. |
java.lang.String |
get(GRB.StringParam param)
Query the value of a string-valued parameter. |
java.lang.String |
getErrorMsg()
Query the error message for the most recent exception associated with this environment. |
void |
getParamInfo(GRB.DoubleParam param,
double[] info)
Obtain detailed information about a double parameter. |
void |
getParamInfo(GRB.IntParam param,
int[] info)
Obtain detailed information about an integer parameter. |
void |
getParamInfo(GRB.StringParam param,
java.lang.String[] info)
Obtain detailed information about a string parameter. |
void |
message(java.lang.String message)
Write a message to the console and the log file. |
protected void |
modelCntDecrease()
|
protected void |
modelCntIncrease()
|
protected boolean |
modelCntZero()
|
void |
readParams(java.lang.String paramFile)
Read new parameter settings from a file. |
void |
release()
Release the license associated with this environment. |
void |
resetParams()
Reset all parameters to their default values. |
void |
set(GRB.DoubleParam param,
double newval)
Set the value of a double-valued parameter. |
void |
set(GRB.IntParam param,
int newval)
Set the value of an int-valued parameter. |
void |
set(GRB.StringParam param,
java.lang.String newval)
Set the value of a string-valued parameter. |
void |
set(java.lang.String param,
java.lang.String newval)
Set the value of any parameter using strings alone. |
void |
start()
Start an empty environment. |
void |
writeParams(java.lang.String paramFile)
Write all non-default parameter settings to a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GRBEnv() throws GRBException
GRBException
public GRBEnv(java.lang.String logFileName) throws GRBException
logFileName
- The desired log file name.
GRBException
public GRBEnv(boolean empty) throws GRBException
GRBException
public GRBEnv(java.lang.String logFileName, java.lang.String computeServer, java.lang.String router, java.lang.String password, java.lang.String group, int tlsInsecure, int priority, double timeout) throws GRBException
logFileName
- The name of the log file for this environment. Pass an empty string
for no log file.computeServer
- \EnvargComputeServerrouter
- \EnvargRouterpassword
- \EnvargPasswordgroup
- \EnvargGrouptlsInsecure
- \EnvargTlsInsecurepriority
- \EnvargPriorityCStimeout
- \EnvargTimeout
GRBException
public GRBEnv(java.lang.String logfilename, java.lang.String accessID, java.lang.String secretKey, java.lang.String pool, int priority) throws GRBException
logfilename
- The name of the log file for this environment. May be NULL
(or an empty string), in which case no log file is created.accessID
- \EnvargAccessIDsecretKey
- \EnvargSecretKeypool
- \EnvargPoolpriority
- \EnvargPriorityCloud
GRBException
public GRBEnv(java.lang.String s0, java.lang.String s1, java.lang.String s2, int i1, java.lang.String s3) throws GRBException
GRBException
Method Detail |
---|
public void start() throws GRBException
GRBException
public void release()
optimize
on models
created with this environment after the license has been released.
public void dispose() throws GRBException
GRBEnv
object. While
the Java garbage collector will eventually reclaim these resources, we
recommend that you call the dispose
method when you are done
using an environment if your program creates more than one.
The dispose
method on a GRBEnv
should be called only
after you have called dispose
on all of the models that were
created within that environment. You should not attempt to use a
GRBEnv
object after calling dispose
.
GRBException
protected void finalize() throws GRBException
finalize
in class java.lang.Object
GRBException
public void message(java.lang.String message) throws GRBException
message
- Print a message to the console and to the log file. Note that this
call has no effect unless the OutputFlag parameter is set.
GRBException
public int get(GRB.IntParam param) throws GRBException
param
- The parameter being queried.
GRBException
public double get(GRB.DoubleParam param) throws GRBException
param
- The parameter being queried.
GRBException
public java.lang.String get(GRB.StringParam param) throws GRBException
param
- The parameter being queried.
GRBException
public void set(GRB.IntParam param, int newval) throws GRBException
param
- The parameter being modified.newval
- The desired new value of the parameter.
GRBException
public void set(GRB.DoubleParam param, double newval) throws GRBException
param
- The parameter being modified.newval
- The desired new value of the parameter.
GRBException
public void set(GRB.StringParam param, java.lang.String newval) throws GRBException
param
- The parameter being modified.newval
- The desired new value of the parameter.
GRBException
public void set(java.lang.String param, java.lang.String newval) throws GRBException
param
- The name of the parameter being modified.newval
- The desired new value of the parameter.
GRBException
public void getParamInfo(GRB.IntParam param, int[] info) throws GRBException
param
- The parameter of interest.info
- The returned information. The result will contain four entries: the
current value of the parameter, the minimum allowed value, the maximum
allowed value, and the default value.
GRBException
public void getParamInfo(GRB.DoubleParam param, double[] info) throws GRBException
param
- The parameter of interest.info
- The returned information. The result will contain four entries: the
current value of the parameter, the minimum allowed value, the maximum
allowed value, and the default value.
GRBException
public void getParamInfo(GRB.StringParam param, java.lang.String[] info) throws GRBException
param
- The parameter of interest.info
- The returned information. The result will contain two entries: the
current value of the parameter and the default value.
GRBException
public void resetParams() throws GRBException
GRBException
public void writeParams(java.lang.String paramFile) throws GRBException
paramFile
- Name of the file to which non-default parameter settings should be
written. The previous contents are overwritten.
GRBException
public void readParams(java.lang.String paramFile) throws GRBException
paramFile
- Name of the file containing parameter settings. Parameters should be
listed one per line, with the parameter name first and the desired
value second. For example: Blank lines and lines that begin with the hash symbol are ignored.
GRBException
public java.lang.String getErrorMsg()
protected void modelCntIncrease()
protected void modelCntDecrease()
protected boolean modelCntZero()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |