Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark mode
Gurobi Optimizer Reference Manual
Light LogoDark Logo

Concepts

Features

Reference

Gurobi
Back to top

Parameter Management#

intGRBgetdblparam(GRBenv*env,constchar*paramname,double*valueP)#

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.

Return value:

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.

Arguments:
  • 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.

Example:
doublecutoff;error=GRBgetdblparam(GRBgetenv(model),"Cutoff",&cutoff);
intGRBgetintparam(GRBenv*env,constchar*paramname,int*valueP)#

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.

Return value:

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.

Arguments:
  • 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.

Example:
intlimit;error=GRBgetintparam(GRBgetenv(model),"SolutionLimit",&limit);
intGRBgetstrparam(GRBenv*env,constchar*paramname,char*value)#

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.

Return value:

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.

Arguments:
  • 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.

Example:
charlogfilename[GRB_MAX_STRLEN];error=GRBgetstrparam(GRBgetenv(model),"LogFile",logfilename);
intGRBsetdblparam(GRBenv*env,constchar*paramname,doublenewvalue)#

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.

Return value:

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.

Arguments:
  • 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.

Example:
error=GRBsetdblparam(GRBgetenv(model),"Cutoff",100.0);
intGRBsetintparam(GRBenv*env,constchar*paramname,intnewvalue)#

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.

Return value:

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.

Arguments:
  • 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.

Example:
error=GRBsetintparam(GRBgetenv(model),"SolutionLimit",5);
intGRBsetstrparam(GRBenv*env,constchar*paramname,constchar*newvalue)#

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.

Return value:

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.

Arguments:
  • 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.

Example:
error=GRBsetstrparam(GRBgetenv(model),"LogFile","/tmp/new.log");
intGRBsetparam(GRBenv*env,constchar*paramname,constchar*newvalue)#

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.

Return value:

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.

Arguments:
  • 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.

Example:
error=GRBsetparam(GRBgetenv(model),"Cutoff","100.0");
intGRBgetdblparaminfo(GRBenv*env,constchar*paramname,double*valueP,double*minP,double*maxP,double*defaultP)#

Retrieve information about a double-valued parameter. Specifically,retrieve the current value of the parameter, the minimum and maximumallowed values, and the default value.

Return 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.

Arguments:
  • 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.

Example:
error=GRBgetdblparaminfo(GRBgetenv(model),"MIPGap",&currentGap,&minAllowedGap,NULL,&defaultGap);
intGRBgetintparaminfo(GRBenv*env,constchar*paramname,int*valueP,int*minP,int*maxP,int*defaultP)#

Retrieve information about an int-valued parameter. Specifically,retrieve the current value of the parameter, the minimum and maximumallowed values, and the default value.

Return 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.

Arguments:
  • 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.

Example:
error=GRBgetintparaminfo(GRBgetenv(model),"SolutionLimit",&current,&minAllowedLimit,NULL,&defaultLimit);
intGRBgetstrparaminfo(GRBenv*env,constchar*paramname,char*value,char*defaultP)#

Retrieve information about a string-valued parameter. Specifically,retrieve the current and default values of the parameter.

Return 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.

Arguments:
  • 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.

Example:
chardefaultval[GRB_MAX_STRLEN];charcurrentval[GRB_MAX_STRLEN];error=GRBgetstrparaminfo(GRBgetenv(model),"LogFile",currentval,defaultval);
intGRBreadparams(GRBenv*env,constchar*filename)#

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.

Return value:

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.

Arguments:
  • 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.

Example:
error=GRBreadparams(env,"/tmp/model.prm.bz2");
intGRBresetparams(GRBenv*env)#

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.

Return value:

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.

Arguments:
  • env – The environment for which the parameters should bereset to their default value.

Example:
error=GRBresetparams(env);
intGRBwriteparams(GRBenv*env,constchar*filename)#

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.

Return value:

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.

Arguments:
  • 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.

Example:
error=GRBwriteparams(env,"/tmp/model.prm");

Help and Feedback

On this page

[8]ページ先頭

©2009-2025 Movatter.jp