Goto Chapter: Top 1 2 3 4 5 Bib Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

3 Using Gurobify
 3.1 Creating Or Reading A Model
 3.2 Adding And Deleting Constraints
 3.3 Adding And Modifying Objective Functions
 3.4 Optimising A Model
 3.5 Querying Attributes And Parameters
 3.6 Querying Other Attributes And Parameters
 3.7 Modifying Attributes And Parameters
 3.8 Modifying Other Attributes And Parameters
 3.9 Additional Functionality
 3.10 Other

3 Using Gurobify

This chapter documents the various commands available in Gurobify. Each command begins with "Gurobi", which in some instances helps to avoid conflict with other GAP commands, and is used for consistancy in other instances. It is important to note that many changes to a model do not become active until the model is updated. This can be done by either optimising the model, or calling GurobiUpdateModel. It is often unnecessary to update the model if it will later be optimised, and in fact can be more efficient to only update when necessary. However, one may occasionally wish to perform a command which is dependent on previous changes to the model. In this case it is necessary to call the update command first.

3.1 Creating Or Reading A Model

This section deals with reading, writing, and creating models, as well as working with the model variables.

3.1-1 GurobiReadModel
‣ GurobiReadModel( ModelFile )( function )

Returns: a Gurobi model.

Takes a model file, reads it and creates a Gurobi model from it. ModelFile is the name of the file as a string, with the appropriate extension, and including the path if the file is not located in the current GAP working directory. Gurobi accepts files of type .mps, .rew, .lp, .rlp, .ilp, or .opb. Refer to the gurobi documentation for more infomation on which file types can be read.

3.1-2 GurobiWriteToFile
‣ GurobiWriteToFile( Model, FileName )( function )

Returns: true

Takes a model and writes it to a file. File type written is determined by the FileName suffix. File types include .mps, .rew, .lp, .rlp, .ilp, .sol, or .prm. Refer to the gurobi documentation for more infomation on which file types can be written.

3.1-3 GurobiNewModel
‣ GurobiNewModel( VariableTypes[, VariableNames] )( operation )

Returns: A Gurobi model

Creates a gurobi model with variables defined by VariableTypes. VariableTypes must be a list of strings, where each entry is the type of the corresponding variable. Accepted variable types are "CONTINUOUS", "BINARY", "INTEGER", "SEMICONT", or "SEMIINT". The variable types are not case sensitive. Refer to the Gurobi documentation for more information on the variable types. Optionally takes the names of the variables as a list of strings.

3.1-4 GurobiNewModel
‣ GurobiNewModel( n, VariableType )( operation )

Returns: A Gurobi model

Creates a new Gurobi model, with n variables, all of type VariableType. Accepted variable types are "CONTINUOUS", "BINARY", "INTEGER", "SEMICONT", or "SEMIINT". The variable types are not case sensitive. Refer to the Gurobi documentation for more information on the variable types.

3.1-5 GurobiSetVariableNames
‣ GurobiSetVariableNames( Model, VariableNames )( operation )

Returns: true

Assigns each variable a new name from a list of names. The names must be strings.

3.2 Adding And Deleting Constraints

This section deals with adding linear constraints, both individually and in bulk, and also naming and deleting constraints.

3.2-1 GurobiDeleteSingleConstraintWithName
‣ GurobiDeleteSingleConstraintWithName( Model, ConstraintName )( function )

Returns: true

Deletes a single constraint from a model with the name ConstraintName. If multiple constraints have this name, then one will be deleted at random.

3.2-2 GurobiDeleteConstraints
‣ GurobiDeleteConstraints( Model, ConstraintName )( function )

Returns: true

Deletes all constraints from a model which are indexed by the values of ConstraintList. Requires an update to the model to take effect.

3.2-3 GurobiDeleteConstraintsWithName
‣ GurobiDeleteConstraintsWithName( Model, ConstraintName )( operation )

Returns: true/false

Deletes all constraints with the name ConstraintName

3.2-4 GurobiAddConstraint
‣ GurobiAddConstraint( Model, ConstraintEquation, ConstraintSense, ConstraintRHSValue[, ConstraintName] )( operation )

Returns: true

Same as below, except that ConstraintRHS value takes an integer value.

3.2-5 GurobiAddConstraint
‣ GurobiAddConstraint( Model, ConstraintEquation, ConstraintSense, ConstraintRHSValue[, ConstraintName] )( operation )

Returns: true

Adds a constraint to a gurobi model. ConstraintEquation must be a list, such that each entry is the coefficient (including 0 coefficents) of the corresponding variable in the constraint equation. The ConstraintSense must be one of "<", ">" or "=", where Gurobi interprets < as <= and > as >=. The ConstraintRHSValue is the value on the right hand side of the constraint. A constraint may optionally be given a name, which helps to identify the constraint if it is to be deleted at some point. If no constraint name is given, then a constraint is simply assigned the name "UnNamedConstraint". Note that a model must be updated or optimised before any additional constraints become effective.

3.2-6 GurobiAddMultipleConstraints
‣ GurobiAddMultipleConstraints( Model, ConstraintEquations, ConstraintSenses, ConstraintRHSValues[, ConstraintNames] )( operation )

Returns: true

Add multiple constraints to a model at one time. The arguments (except Model) are lists, such that the i-th entries of each list determine a single constraint in the same manner as for the operation GurobiAddConstraint. ConstraintNames is an optional argument, and must be given for all constraints, or not at all.

3.2-7 GurobiAddMultipleConstraints
‣ GurobiAddMultipleConstraints( Model, ConstraintEquations, ConstraintSense, ConstraintRHSValue[, ConstraintName] )( operation )

Returns: true

Add multiple constraints to a model at one time, where the sense, rhs, and optionally name, of each constraint is the same. ConstraintEquations must be a list of constraints, ConstraintSense must be a string, ConstraintRHSValue must be a float or an integer. ConstraintName is an optional argument, which if given, must be a string.

3.3 Adding And Modifying Objective Functions

This section deals with adding and modifying objective functions to a model, and changing between maximising and minimising objective functions.

3.3-1 GurobiMaximiseModel
‣ GurobiMaximiseModel( Model )( operation )

Returns: true

Sets the model sense to maximise. When the model is optimised, it will try to maximise the objective function.

3.3-2 GurobiMinimiseModel
‣ GurobiMinimiseModel( Model )( operation )

Returns: true

Sets the model sense to minimise. When the model is optimised, it will try to minimise the objective function.

3.3-3 GurobiSetObjectiveFunction
‣ GurobiSetObjectiveFunction( Model, ObjectiveValues )( operation )

Returns: true

Set the objective function for a model. ObjectiveValues is a list of coefficients (including 0 coefficeints) corresponding to each of the variables

3.3-4 GurobiObjectiveFunction
‣ GurobiObjectiveFunction( Model )( operation )

Returns: List of coefficients of the objective function

View the objective function for a model.

3.4 Optimising A Model

This section deals with optimising a model, and handling solution information.

3.4-1 GurobiOptimiseModel
‣ GurobiOptimiseModel( Model )( function )

Returns: Optimisation status code.

Takes a Gurobi model and optimises it. Returns the optimisation status code which indicates the outcome of the optimisation. A status code of 2 indicates that a feasible solution was found, a status code of 3 indicates the model is infeasible. There a number of other status codes. Refer to the Gurobi documentation for more information about status codes, or alternatively see the Appendix of this manual. The model itself is altered to reflect the optimisation, and more information about it can be obatained using other commands, in particular the GurobiSolution and GurobiObjectiveValue functions.

3.4-2 GurobiReset
‣ GurobiReset( Model )( function )

Returns: true

Reset all information associated with an optimisation of the model, such as the optimisation status, the solution and the objective value.

3.4-3 GurobiUpdateModel
‣ GurobiUpdateModel( Model )( function )

Returns: true

Takes a model and updates it. Changes to a model (such as changes to parameters or constraints) are not processed until the model is either updated or optimised.

3.4-4 GurobiSolution
‣ GurobiSolution( Model )( operation )

Returns: Solution

Display the solution found for a successfuly optimised model. Note that if a solution has not been optimised, is infeasible, or the optimisation was not completed, then this will return an error. Thus it is advisable to first check the optimisation status.

3.4-5 GurobiObjectiveValue
‣ GurobiObjectiveValue( Model )( operation )

Returns: objective value

Returns the objective value of the current solution.

3.4-6 GurobiOptimisationStatus
‣ GurobiOptimisationStatus( Model )( operation )

Returns: optimisation status code

Returns the optimisation status code of the most recent optimisation. Refer to the Gurobi documentation for more on the optimisation statuses, or alternatively refer to the Appendix of this manual.

3.4-7 GurobiFindAllBinarySolutions
‣ GurobiFindAllBinarySolutions( Model, Size )( operation )

Returns: Set of all solutions.

This function finds all possible solutions of a given size, for a model with only binary variables. Takes a Gurobi model and repeatedly optimises it, each time adding the previous solution as a constraint so that it isn't found again. This continues until all solutions are found, and then they are returned as a set. During the process the number of found solutions is displayed. Note: - Only for models where every variable is a binary variable. - Only finds solution sets of a given size.

3.4-8 GurobiFindAllBinarySolutions
‣ GurobiFindAllBinarySolutions( Model, Size, Group )( operation )

Returns: Set of all solutions.

This function finds all possible solutions of a given size, for a model with only binary variables. Same as above, except that it also takes a permutation group acting on the index set of variables. Instead of finding all solutions directly, the group is used to find the orbit of each new solution, and these are then all returned at the end, and used as constraints until then. An option value may also be given which will only return the representatives of each orbit of the solutions. Hence it returns all the unique solutions up to equivalence under the group. This saves on memory, and the remaing solutions may be refound by generating the orbit under the group. To invoke this option place a colon after the group argument and then put representatives:=true so for example GurobiFindAllSolutions(model, size, gp : representatives:=true);

3.5 Querying Attributes And Parameters

This section deals with obtaining information about attributes and parameters of a Gurobi model. Note that a model must be updated or optimised before parameters and attributes are updated - any queries will return the values at the time the model was last updated or optimised. Note also that the attributes are Gurobi attributes, and are not true attributes in the GAP sense. Crucially, attributes for a model constantly change, either as a result of optimisation or from manually setting them. Thus attributes for Gurobi models are approximated by Gurobify using GAP operations or functions. Their usage should still be comfortable for users familiar with GAP attributes.

3.5-1 GurobiNumberOfVariables
‣ GurobiNumberOfVariables( Model )( operation )

Returns: Number of variables

Returns the number of variables in the model.

3.5-2 GurobiNumberOfConstraints
‣ GurobiNumberOfConstraints( Model )( operation )

Returns: Number of linear constraints

Returns the number of linear constraints in the model.

3.5-3 GurobiObjectiveBound
‣ GurobiObjectiveBound( Model )( operation )

Returns: objective bound

Returns the best known bound on the objective value of the model.

3.5-4 GurobiRunTime
‣ GurobiRunTime( Model )( operation )

Returns: run time of optimisation

Returns the wall clock runtime in seconds for the most recent optimisation.

3.5-5 GurobiNumericFocus
‣ GurobiNumericFocus( Model )( operation )

Returns: numeric focus

Returns the numeric focus value of the model. The numeric focus is a value in the set [0,1,2,3]. A numeric focus of 0 sets the numeric focus automatically, preferencing speed. Values between 1 and 3 increase the care taken in computations as the value increases, but also take longer. The default value is 0.

3.5-6 GurobiTimeLimit
‣ GurobiTimeLimit( Model )( operation )

Returns: time limit

Returns the time limit for the model. The default value is infinity.

3.5-7 GurobiCutOff
‣ GurobiCutOff( Model )( operation )

Returns: cutoff value

Returns the cutoff value for the model. Optimisation will terminate if the objective value is worse than CutOff. The default value is infinity for minimisation, and negative infinity for maximisation.

3.5-8 GurobiBestObjectiveBoundStop
‣ GurobiBestObjectiveBoundStop( Model )( operation )

Returns: best objective bound limit value

Returns the best objective bound limit value for the model. Optimisation will terminate if a feasible solution is found with objective value at least as good as the best objective bound. The default value is negative infinity.

3.5-9 GurobiMIPFocus
‣ GurobiMIPFocus( Model )( operation )

Returns: MIP focus

Returns the MIP focus value for the model. The mip focus must be in the set [0,1,2,3], and the default value is 0. The MIP focus alows you to prioritise finding solutions or proving their optimality. See the Gurobi documentation for more information.

3.5-10 GurobiBestBoundStop
‣ GurobiBestBoundStop( Model )( operation )

Returns: Best bound stopping value

Returns the best bound stopping value for the model. Optimisation terminates as soon as the value of the best bound is determined to be at least as good as the best bound stopping value. Default value is infinity.

3.5-11 GurobiSolutionLimit
‣ GurobiSolutionLimit( Model )( operation )

Returns: solution limit value

Returns the solution limit value for the model. This value limits the maximum number of MIP solutions that will be found. Default value is 2,000,000,000.

3.5-12 GurobiIterationLimit
‣ GurobiIterationLimit( Model )( operation )

Returns: Iteration limit

Returns the iteration limit value for the model, which limits the number of simplex iterations performed during optimisation. Default value is infinity.

3.5-13 GurobiNodeLimit
‣ GurobiNodeLimit( Model )( operation )

Returns: Node limit

Returns the node limit value for the model, which limits the number of MIP nodes explored during optimisation. The default value is infinity.

3.5-14 GurobiVariableNames
‣ GurobiVariableNames( Model )( operation )

Returns the names of the variables in the model. This list acts as the index set for any lists of variable coefficients, such as in GurobiAddConstraint or GurobiSetObjectiveFunction.

3.5-15 GurobiLogToConsole
‣ GurobiLogToConsole( Model )( operation )

Returns: true/false

Returns true if the Gurobi output is set to display to the screen, and false if the output is supressed. Gurobify suppresses the output by default.

3.5-16 GurobiVariableTypes
‣ GurobiVariableTypes( Model )( operation )

Returns the types of the variables in the model.

3.5-17 GurobiMethod
‣ GurobiMethod( Model )( operation )

Returns: MethodType

Returns the method used to solve a model. See the Gurobi documentation for more details.

3.5-18 GurobiThreads
‣ GurobiThreads( Model )( operation )

Returns: ThreadCount

Returns number of threads Gurobi is allowed to use. See the Gurobi documentation for more details.

3.6 Querying Other Attributes And Parameters

In addition to the specific queries given in the previous section, other gurobi parameters and attributes of specific value types can also be queried. The parameter or attribute name must be given as a string exactly as stated in the Gurobi documentation. See the Appendix for links to the relevant documentation.

3.6-1 GurobiIntegerParameter
‣ GurobiIntegerParameter( Model, ParameterName )( function )

Returns: parameter value

Takes a Gurobi model and retrieves the value of a integer-valued parameter. Refer to the Gurobi documentation for a list of parameters and their types.

3.6-2 GurobiDoubleParameter
‣ GurobiDoubleParameter( Model, ParameterName )( function )

Returns: parameter value

Takes a Gurobi model and retrieves the value of a double-valued parameter. Refer to the Gurobi documentation for a list of parameters and their types.

3.6-3 GurobiIntegerAttribute
‣ GurobiIntegerAttribute( Model, AttributeName )( function )

Returns: attribute value

Takes a Gurobi model and retrieves the value of an integer-valued attribute. Refer to the Gurobi documentation for a list of attributes and their types.

3.6-4 GurobiStringAttributeElement
‣ GurobiStringAttributeElement( Model, position, AttributeName )( function )

Returns: attribute value

Takes a Gurobi model and retrieves the value of a string attribute element at a given position. For example to get the names of constraints with "ConstrName". Refer to the Gurobi documentation for a list of attributes and their types.

3.6-5 GurobiDoubleAttribute
‣ GurobiDoubleAttribute( Model, AttributeName )( function )

Returns: attribute value

Takes a Gurobi model and retrieves the value of a double-valued attribute. Refer to the Gurobi documentation for a list of attributes and their types.

3.6-6 GurobiIntegerAttributeArray
‣ GurobiIntegerAttributeArray( Model, AttributeName )( function )

Returns: attribute array

Takes a Gurobi model and retrieves an attribute array. Can only get values of attributes arrays which take integer values. Refer to the Gurobi documentation for a list of attributes and their types.

3.6-7 GurobiDoubleAttributeArray
‣ GurobiDoubleAttributeArray( Model, AttributeName )( function )

Returns: attribute array

Takes a Gurobi model and retrieves an attribute array. Can only get values of attributes arrays which take double values. Refer to the Gurobi documentation for a list of attributes and their types.

3.6-8 GurobiStringAttributeArray
‣ GurobiStringAttributeArray( Model, AttributeName )( function )

Returns: attribute array

Takes a Gurobi model and retrieves an attribute array. Can only get values of attributes arrays which have string values. Refer to the Gurobi documentation for a list of attributes and their types.

3.6-9 GurobiCharAttributeArray
‣ GurobiCharAttributeArray( Model, AttributeName )( function )

Returns: attribute array

Takes a Gurobi model and retrieves an attribute array. Can only get values of attributes arrays which have char values. Refer to the Gurobi documentation for a list of attributes and their types.

3.7 Modifying Attributes And Parameters

This section deals with modifying the values of attributes and parameters of Gurobi models. Note that a model must be updated or optimised before parameters and attributes are updated. Any queries or commands which depend on these values will use the values at the time the model was last updated or optimised, even if the values have since been modified.

3.7-1 GurobiSetTimeLimit
‣ GurobiSetTimeLimit( Model, TimeLimit )( operation )

Returns: true

Set a time limit for a Gurobi model. Note that TimeLimit should be a float, however an integer value can be given which will be automatically converted to a float.

3.7-2 GurobiSetBestObjectiveBoundStop
‣ GurobiSetBestObjectiveBoundStop( Model, BestObjectiveBoundStop )( operation )

Returns: true

Optimisation will terminate if a feasible solution is found with objective value at least as good as BestObjectiveBoundStop. Note that BestObjectiveBoundStop should be a float, however an integer value can be given which will be automatically converted to a float.

3.7-3 GurobiSetCutOff
‣ GurobiSetCutOff( Model, CutOff )( operation )

Returns: true

Optimisation will terminate if the objective value is worse than CutOff. Note that CutOff should be a float, an integer value can be given which will be automatically converted to a float.

3.7-4 GurobiSetNumericFocus
‣ GurobiSetNumericFocus( Model, NumericFocus )( operation )

Returns: true

Set the numeric focus for a model. Numeric focus must be in the set [0,1,2,3]. A numeric focus of 0 sets the numeric focus automatically, preferencing speed. Values between 1 and 3 increase the care taken in computations as the value increases, but also take longer. The default value is 0.

3.7-5 GurobiSetMIPFocus
‣ GurobiSetMIPFocus( Model, MIPFocus )( operation )

Returns: true

Set the MIP focus for a model. The mip focus must be in the set [0,1,2,3], and the default value is 0. The MIP focus alows you to prioritise finding solutions or proving their optimality. See the Gurobi documentation for more information.

3.7-6 GurobiSetBestBoundStop
‣ GurobiSetBestBoundStop( Model, BestBdStop )( operation )

Returns: true

Set the best bound stopping value for a model. Terminates optimisation as soon as the value of the best bound is determined to be at least as good as the best bound stopping value. Default value is infinity.

3.7-7 GurobiSetSolutionLimit
‣ GurobiSetSolutionLimit( Model, BestBdStop )( operation )

Returns: true

Set the limit for the maximum number of MIP solutions to find. Default value is 2,000,000,000.

3.7-8 GurobiSetIterationLimit
‣ GurobiSetIterationLimit( Model, IterationLimit )( operation )

Returns: true

Set the limit for the maximum number of simplex iterations performed. Default value is infinity.

3.7-9 GurobiSetNodeLimit
‣ GurobiSetNodeLimit( Model, NodeLimit )( operation )

Returns: true

Set the limit for the maximum number of MIP nodes explored. The default value is infinity.

3.7-10 GurobiSetLogToConsole
‣ GurobiSetLogToConsole( Model, Switch )( operation )

Returns: true

Turns console logging on or off. If Switch is true the output of Gurobi will be printed to the screen, and if it is false the output will be supressed. The default for Gurobify is to supress the output.

3.7-11 GurobiSetMethod
‣ GurobiSetMethod( Model, MethodType )( operation )

Returns: true

Set the method used to solve a model. -1=automatic (this is the default), 0=primal simplex, 1=dual simplex, 2=barrier, 3=concurrent, 4=deterministic concurrent, 5=deterministic concurrent simplex. See the Gurobi documentation for more details.

3.7-12 GurobiSetThreads
‣ GurobiSetThreads( Model, ThreadCount )( operation )

Returns: true

Set the number of threads Gurobi is allowed to use. The default value is 0, which will use as many cores as it wants. See the Gurobi documentation for more details.

3.8 Modifying Other Attributes And Parameters

In addition to these specific commands given in the previous section, other gurobi parameters and attributes of specific value types can be modified. The parameter or attribute name must be given as a strings exactly as stated in the Gurobi documentation. See the Appendix for links to the relevant documentation.

3.8-1 GurobiSetIntegerParameter
‣ GurobiSetIntegerParameter( Model, ParameterName, ParameterValue )( function )

Takes a Gurobi model and assigns a value to a given integer-valued parameter. ParameterValue must be a integer value. Refer to the Gurobi documentation for a list of parameters and their types.

3.8-2 GurobiSetDoubleParameter
‣ GurobiSetDoubleParameter( Model, ParameterName, ParameterValue )( function )

Takes a Gurobi model and assigns a value to a given double-valued parameter. ParameterValue must be a double value. Refer to the Gurobi documentation for a list of parameters and their types.

3.8-3 GurobiSetIntegerAttribute
‣ GurobiSetIntegerAttribute( Model, AttributeName, AttributeValue )( function )

Takes a Gurobi model and assigns a value to a given integer-valued attribute. AttributeValue must be a double value. Refer to the Gurobi documentation for a list of attributes and their types.

3.8-4 GurobiSetDoubleAttribute
‣ GurobiSetDoubleAttribute( Model, AttributeName, AttributeValue )( function )

Takes a Gurobi model and assigns a value to a given double-valued attribute. AttributeValue must be a double value. Refer to the Gurobi documentation for a list of attributes and their types.

3.8-5 GurobiSetDoubleAttributeArray
‣ GurobiSetDoubleAttributeArray( Model, AttributeName, AttributeValueArray )( function )

Takes a Gurobi model and assigns a value to a given attribute which takes an array of floats. AttributeValue must be an array of floats. Refer to the Gurobi documentation for a list of attributes and their types.

3.9 Additional Functionality

This section provides information on some additional functionality which does not directly relate to Gurobi but may assist in using the Gurobify package. In particular, it details functions which convert between characteristic vectors (which are more desirable for use with Gurobi) and sets (which may be more desirable for use in GAP).

3.9-1 IndexSetToCharacteristicVector
‣ IndexSetToCharacteristicVector( IndexSet, NumberOfIndices )( operation )

Returns: Characterisitc vector

Takes a list of integers which form a subset of the set [1 .. n], where n is the second argument, and converts the set of indices to its characteristic vector. For example, if n = 5, the set [1,3] would be converted to [1, 0, 1, 0, 0]. It is useful to be able to convert between the two, since Gurobify always takes the characteristic vector (for example when taking constraints), yet the set of indices is generally more helpful for the user.

3.9-2 CharacteristicVectorToIndexSet
‣ CharacteristicVectorToIndexSet( CharacteristicVector )( operation )

Returns: Index set

Takes a characteristic vector and returns the set of indices corresponding to it. This reverses the process which occurs with IndexSetToCharacteristicVector. It is particularly useful to convert the output of a Gurobi solution back in terms of the variables. For example, the characteristic vector [1, 0, 1, 0, 0] would return the index set [1,3]. Note that since the function expects a characteristic vector it doesn't account for any weightings, and is only interested in whether or not the corresponding index is present, and as such it rounds each entry to the nearest integer and checks that it is non-zero. Hence it is particularly suitable for use with binary variables.

3.9-3 SubsetToCharacteristicVector
‣ SubsetToCharacteristicVector( Subset, FullSet )( operation )

Returns: Characterisitc vector

Takes a subset of some set, and returns the characteristic vector where the entries of the characteristic vector are indexed by the full set. For example, the subset ["c"] of ["a", "c", "n", "q"] would give the characteristic vector [0, 1, 0, 0]. This removes the need to first find the index set of the subset.

3.9-4 SubsetToIndexSet
‣ SubsetToIndexSet( Subset, FullSet )( operation )

Returns: Index set

Takes a subset of some set, and returns the set of indices corresponding to it. For example, the subset ["a", "d"] of the set ["a", "b", "c", "d", "e"], would return the index set [1,4]. Note that since the method expects a subset (not a multiset) vector it doesn't account for any weightings or repetition.

3.9-5 CharacteristicVectorToSubset
‣ CharacteristicVectorToSubset( CharacteristicVector )( operation )

Returns: Subset

Takes a characteristic vector and some set which it takes to be indexing the entries of the characteristic vector. It then returns the subset of the full set corresponding to the non-zero entries of the characteristic vector. This is the reverse process to SubsetToCharacteristicVector. Note again that the characteristic vector is rounded to an integer before being compared to 0. As an example, the characteristic vector [0, 1, 0, 0] with the set ["a", "c", "n", "q"] would return ["c"]. This removes the need to first return an index set before finding the subset.

3.10 Other

This section documents Gurobify functionality not belonging in any of the other sections.

3.10-1 GurobiVersion
‣ GurobiVersion( )( function )

Returns: [ major_version, minor_version, technical_version ]

This function returns a list [ major_version, minor_version, technical_version ] which indicates the Gurobi library version. For example, if using Gurobi Version 7.5.1, then GurobiVersion() would return [ 7, 5, 1 ].

 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 5 Bib Ind

generated by GAPDoc2HTML