Concepts
Features
Reference
Retrieve the value of a double-valued parameter.
Note that a model gets its own copy of theenvironment when it is created. Changes to the original environment haveno effect on the copy, and vice versa. UseGRBgetenv toretrieve the environment associated with a model if you would like toquery the parameter value for that model.
A non-zero return value indicates that a problem occurred while retrieving the parameter.Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment whose parameter value is being queried.
paramname – The name of the parameter. Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
valueP – The location in which the current value of the requestedparameter should be placed.
doublecutoff;error=GRBgetdblparam(GRBgetenv(model),"Cutoff",&cutoff);
Retrieve the value of an integer-valued parameter.
Note that a model gets its own copy of theenvironment when it is created. Changes to the original environment haveno effect on the copy, and vice versa. UseGRBgetenv toretrieve the environment associated with a model if you would like toquery the parameter value for that model.
A non-zero return value indicates that a problem occurred while retrieving the parameter.Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment whose parameter value is being queried.
paramname – The name of the parameter. Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
valueP – The location in which the current value of the requestedparameter should be placed.
intlimit;error=GRBgetintparam(GRBgetenv(model),"SolutionLimit",&limit);
Retrieve the value of a string-valued parameter.
Note that a model gets its own copy of theenvironment when it is created. Changes to the original environment haveno effect on the copy, and vice versa. UseGRBgetenv toretrieve the environment associated with a model if you would like toquery the parameter value for that model.
A non-zero return value indicates that a problem occurred while retrieving the parameter.Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment whose parameter value is being queried.
paramname – The name of the parameter. Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
value – The location in which the current value of the requestedparameter should be placed.
charlogfilename[GRB_MAX_STRLEN];error=GRBgetstrparam(GRBgetenv(model),"LogFile",logfilename);
Modify the value of a double-valued parameter.
Note that a model gets its own copy of theenvironment when it is created. Changes to the original environment haveno effect on the copy, and vice versa. UseGRBgetenv toretrieve the environment associated with a model if you would like tochange the parameter value for that model.
A non-zero return value indicates that a problem occurred while modifying the parameter. Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment whose parameter value is being modified.
paramname – The name of the parameter. Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
newvalue – The desired new value of the parameter.
error=GRBsetdblparam(GRBgetenv(model),"Cutoff",100.0);
Modify the value of an integer-valued parameter.
Note that a model gets its own copy of theenvironment when it is created. Changes to the original environment haveno effect on the copy, and vice versa. UseGRBgetenv toretrieve the environment associated with a model if you would like tochange the parameter value for that model.
A non-zero return value indicates that a problem occurred while modifying the parameter. Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment whose parameter value is being modified.
paramname – The name of the parameter. Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
newvalue – The desired new value of the parameter.
error=GRBsetintparam(GRBgetenv(model),"SolutionLimit",5);
Modify the value of a string-valued parameter.
Note that a model gets its own copy of theenvironment when it is created. Changes to the original environment haveno effect on the copy, and vice versa. UseGRBgetenv toretrieve the environment associated with a model if you would like tochange the parameter value for that model.
A non-zero return value indicates that a problem occurred while modifying the parameter. Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment whose parameter value is being modified.
paramname – The name of the parameter. Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
newvalue – The desired new value of the parameter.
error=GRBsetstrparam(GRBgetenv(model),"LogFile","/tmp/new.log");
Modify the value of a parameter.
Note that a model gets its own copy of theenvironment when it is created. Changes to the original environment haveno effect on the copy, and vice versa. UseGRBgetenv toretrieve the environment associated with a model if you would like tochange the parameter value for that model.
A non-zero return value indicates that a problem occurred while modifying the parameter. Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment whose parameter value is being modified.
paramname – The name of the parameter. Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
newvalue – The desired new value of the parameter.
error=GRBsetparam(GRBgetenv(model),"Cutoff","100.0");
Retrieve information about a double-valued parameter. Specifically,retrieve the current value of the parameter, the minimum and maximumallowed values, and the default value.
A non-zero return value indicates that a problem occurred while retrieving parameter information.Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment whose parameter information is being queried.
paramname – The name of the parameter. Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
valueP – (optional) The location in which the current value of thespecified parameter should be placed.
minP – (optional) The location in which the minimum allowed value ofthe specified parameter should be placed.
maxP – (optional) The location in which the maximum allowed value ofthe specified parameter should be placed.
defaultP – (optional) The location in which the default value of thespecified parameter should be placed.
error=GRBgetdblparaminfo(GRBgetenv(model),"MIPGap",¤tGap,&minAllowedGap,NULL,&defaultGap);
Retrieve information about an int-valued parameter. Specifically,retrieve the current value of the parameter, the minimum and maximumallowed values, and the default value.
A non-zero return value indicates that a problem occurred while retrieving parameter information.Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment whose parameter information is being queried.
paramname – The name of the parameter. Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
valueP – (optional) The location in which the current value of thespecified parameter should be placed.
minP – (optional) The location in which the minimum allowed value ofthe specified parameter should be placed.
maxP – (optional) The location in which the maximum allowed value ofthe specified parameter should be placed.
defaultP – (optional) The location in which the default value of thespecified parameter should be placed.
error=GRBgetintparaminfo(GRBgetenv(model),"SolutionLimit",¤t,&minAllowedLimit,NULL,&defaultLimit);
Retrieve information about a string-valued parameter. Specifically,retrieve the current and default values of the parameter.
A non-zero return value indicates that a problem occurred while retrieving parameter information.Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment whose parameter information is being queried.
paramname – The name of the parameter. Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
value – (optional) The location in which the current value of thespecified parameter should be placed.
defaultP – (optional) The location in which the default value of thespecified parameter should be placed.
chardefaultval[GRB_MAX_STRLEN];charcurrentval[GRB_MAX_STRLEN];error=GRBgetstrparaminfo(GRBgetenv(model),"LogFile",currentval,defaultval);
Import a set of parameter modifications from a file.
Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
A non-zero return value indicates that a problem occurred while reading the parameter file.Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment into which the parameter changes should beimported.
filename – The path to the file to be read. The suffix on a parameterfile should be.prm, optionally followed by.zip,.gz,.bz2,.7z or.xz.
error=GRBreadparams(env,"/tmp/model.prm.bz2");
Reset the values of all parameters to their default values.
Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
A non-zero return value indicates that a problem occurred while resetting parameters.Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment for which the parameters should bereset to their default value.
error=GRBresetparams(env);
Write the set of changed parameter values to a file.
Please consult theparameter section for a complete list of Gurobiparameters, including descriptions of their purposes and their minimum,maximum, and default values.
A non-zero return value indicates that a problem occurred while writing the parameter file.Refer to theError Codes tablefor a list of possible return values. Details on the error can be obtainedby callingGRBgeterrormsg.
env – The environment whose parameter changes are being written.
filename – The path to the file to be written. The suffix on aparameter file should be.prm, optionally followed by.zip,.gz,.bz2,.7z or.xz.
error=GRBwriteparams(env,"/tmp/model.prm");
Help and Feedback