cuOpt LP/MILP C API Reference#
This section contains the cuOpt LP/MILP C API reference.
Integer and Floating-Point Types#
cuOpt may be built with 32 or 64 bit integer and floating-point types. The C API uses a typedef for floating point and integer types to abstract the size of these types.
-
typedef int32_t cuopt_int_t#
The type of the integer number used by the solver. Use
cuOptGetIntSize
to get the size of the integer type.
-
typedef float cuopt_float_t#
The type of the floating point number used by the solver. Use
cuOptGetFloatSize
to get the number of bytes in the floating point type.
You may use the following functions to determine the number of bytes used to represent these types in your build
-
int8_t cuOptGetIntSize()#
Get the size of the integer type used by the library.
- Returns:
The size of the integer type in bytes.
-
int8_t cuOptGetFloatSize()#
Get the size of the float type.
- Returns:
The size in bytes of the float type.
Status Codes#
Every function in the C API returns a status code that indicates success or failure. The following status codes are defined
-
CUOPT_SUCCESS#
-
CUOPT_INVALID_ARGUMENT#
-
CUOPT_MPS_FILE_ERROR#
-
CUOPT_MPS_PARSE_ERROR#
Optimization Problem#
An optimization problem is represented via a cuOptOptimizationProblem
-
typedef void *cuOptOptimizationProblem#
A
cuOptOptimizationProblem
object contains a representation of an LP or MIP. It is created bycuOptCreateProblem
orcuOptCreateRangedProblem
. It is passed tocuOptSolve
. It should be destroyed usingcuOptDestroyProblem
.
Optimization problems can be created via three different functions
- cuopt_int_t cuOptReadProblem(
- const char *filename,
- cuOptOptimizationProblem *problem_ptr
Read an optimization problem from an MPS file.
- Parameters:
filename – [in] - The path to the MPS file.
problem_ptr – [out] - A pointer to a cuOptOptimizationProblem. On output the problem will be created and initialized with the data from the MPS file
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptCreateProblem(
- cuopt_int_t num_constraints,
- cuopt_int_t num_variables,
- cuopt_int_t objective_sense,
- cuopt_float_t objective_offset,
- const cuopt_float_t *objective_coefficients,
- const cuopt_int_t *constraint_matrix_row_offsets,
- const cuopt_int_t *constraint_matrix_column_indices,
- const cuopt_float_t *constraint_matrix_coefficent_values,
- const char *constraint_sense,
- const cuopt_float_t *rhs,
- const cuopt_float_t *lower_bounds,
- const cuopt_float_t *upper_bounds,
- const char *variable_types,
- cuOptOptimizationProblem *problem_ptr
Create an optimization problem of the form.
* minimize/maximize cᵀx + offset * subject to A x {=, ≤, ≥} b * l ≤ x ≤ u * x_i integer for some i *
- Parameters:
num_constraints – [in] The number of constraints
num_variables – [in] The number of variables
objective_sense – [in] The objective sense (CUOPT_MINIMIZE for minimization or CUOPT_MAXIMIZE for maximization)
objective_offset – [in] An offset to add to the linear objective
objective_coefficients – [in] A pointer to an array of type cuopt_float_t of size num_variables containing the coefficients of the linear objective
constraint_matrix_row_offsets – [in] A pointer to an array of type cuopt_int_t of size num_constraints + 1. constraint_matrix_row_offsets[i] is the index of the first non-zero element of the i-th constraint in constraint_matrix_column_indices and constraint_matrix_coefficent_values. This is part of the compressed sparse row representation of the constraint matrix
constraint_matrix_column_indices – [in] A pointer to an array of type cuopt_int_t of size constraint_matrix_row_offsets[num_constraints] containing the column indices of the non-zero elements of the constraint matrix. This is part of the compressed sparse row representation of the constraint matrix
constraint_matrix_coefficent_values – [in] A pointer to an array of type cuopt_float_t of size constraint_matrix_row_offsets[num_constraints] containing the values of the non-zero elements of the constraint matrix. This is part of the compressed sparse row representation of the constraint matrix
constraint_sense – [in] A pointer to an array of type char of size num_constraints containing the sense of the constraints (CUOPT_LESS_THAN, CUOPT_GREATER_THAN, or CUOPT_EQUAL)
rhs – [in] A pointer to an array of type cuopt_float_t of size num_constraints containing the right-hand side of the constraints
lower_bounds – [in] A pointer to an array of type cuopt_float_t of size num_variables containing the lower bounds of the variables
upper_bounds – [in] A pointer to an array of type cuopt_float_t of size num_variables containing the upper bounds of the variables
variable_types – [in] A pointer to an array of type char of size num_variables containing the types of the variables (CUOPT_CONTINUOUS or CUOPT_INTEGER)
problem_ptr – [out] Pointer to store the created optimization problem
- Returns:
CUOPT_SUCCESS if successful, CUOPT_ERROR otherwise
- cuopt_int_t cuOptCreateRangedProblem(
- cuopt_int_t num_constraints,
- cuopt_int_t num_variables,
- cuopt_int_t objective_sense,
- cuopt_float_t objective_offset,
- const cuopt_float_t *objective_coefficients,
- const cuopt_int_t *constraint_matrix_row_offsets,
- const cuopt_int_t *constraint_matrix_column_indices,
- const cuopt_float_t *constraint_matrix_coefficients,
- const cuopt_float_t *constraint_lower_bounds,
- const cuopt_float_t *constraint_upper_bounds,
- const cuopt_float_t *variable_lower_bounds,
- const cuopt_float_t *variable_upper_bounds,
- const char *variable_types,
- cuOptOptimizationProblem *problem_ptr
Create an optimization problem of the form *.
* minimize/maximize c^T x + offset * subject to bl <= A*x <= bu * l <= x <= u * x_i integer for some i *
- Parameters:
num_constraints – [in] - The number of constraints.
num_variables – [in] - The number of variables.
objective_sense – [in] - The objective sense (CUOPT_MINIMIZE for minimization or CUOPT_MAXIMIZE for maximization)
objective_offset – [in] - An offset to add to the linear objective.
objective_coefficients – [in] - A pointer to an array of type cuopt_float_t of size num_variables containing the coefficients of the linear objective.
constraint_matrix_row_offsets – [in] - A pointer to an array of type cuopt_int_t of size num_constraints + 1. constraint_matrix_row_offsets[i] is the index of the first non-zero element of the i-th constraint in constraint_matrix_column_indices and constraint_matrix_coefficients.
constraint_matrix_column_indices – [in] - A pointer to an array of type cuopt_int_t of size constraint_matrix_row_offsets[num_constraints] containing the column indices of the non-zero elements of the constraint matrix.
constraint_matrix_coefficients – [in] - A pointer to an array of type cuopt_float_t of size constraint_matrix_row_offsets[num_constraints] containing the values of the non-zero elements of the constraint matrix.
constraint_lower_bounds – [in] - A pointer to an array of type cuopt_float_t of size num_constraints containing the lower bounds of the constraints.
constraint_upper_bounds – [in] - A pointer to an array of type cuopt_float_t of size num_constraints containing the upper bounds of the constraints.
variable_lower_bounds – [in] - A pointer to an array of type cuopt_float_t of size num_variables containing the lower bounds of the variables.
variable_upper_bounds – [in] - A pointer to an array of type cuopt_float_t of size num_variables containing the upper bounds of the variables.
variable_types – [in] - A pointer to an array of type char of size num_variables containing the types of the variables (CUOPT_CONTINUOUS or CUOPT_INTEGER).
problem_ptr – [out] - A pointer to a cuOptOptimizationProblem. On output the problem will be created and initialized with the provided data.
- Returns:
A status code indicating success or failure.
A optimization problem must be destroyed with the following function
-
void cuOptDestroyProblem(cuOptOptimizationProblem *problem_ptr)#
Destroy an optimization problem.
- Parameters:
problem_ptr – [inout] - A pointer to a cuOptOptimizationProblem. On output the problem will be destroyed, and the pointer will be set to NULL.
Certain constants are needed to define an optimization problem. These constants are described below.
Objective Sense Constants#
These constants are used to define the objective sense in the cuOptCreateProblem and cuOptCreateRangedProblem functions.
-
CUOPT_MINIMIZE#
-
CUOPT_MAXIMIZE#
Constraint Sense Constants#
These constants are used to define the constraint sense in the cuOptCreateProblem and cuOptCreateRangedProblem functions.
-
CUOPT_LESS_THAN#
-
CUOPT_GREATER_THAN#
-
CUOPT_EQUAL#
Variable Type Constants#
These constants are used to define the the variable type in the cuOptCreateProblem and cuOptCreateRangedProblem functions.
-
CUOPT_CONTINUOUS#
-
CUOPT_INTEGER#
Infinity Constant#
This constant may be used to represent infinity in the cuOptCreateProblem and cuOptCreateRangedProblem functions.
-
CUOPT_INFINITY#
Querying an optimization problem#
The following functions may be used to get information about an cuOptimizationProblem
- cuopt_int_t cuOptGetNumConstraints(
- cuOptOptimizationProblem problem,
- cuopt_int_t *num_constraints_ptr
Get the number of constraints of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
num_constraints_ptr – [out] - A pointer to a cuopt_int_t that will contain the number of constraints on output.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetNumVariables(
- cuOptOptimizationProblem problem,
- cuopt_int_t *num_variables_ptr
Get the number of variables of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
num_variables_ptr – [out] - A pointer to a cuopt_int_t that will contain the number of variables on output.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetObjectiveSense(
- cuOptOptimizationProblem problem,
- cuopt_int_t *objective_sense_ptr
Get the objective sense of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
objective_sense_ptr – [out] - A pointer to a cuopt_int_t that on output will contain the objective sense.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetObjectiveOffset(
- cuOptOptimizationProblem problem,
- cuopt_float_t *objective_offset_ptr
Get the objective offset of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
objective_offset_ptr – [out] - A pointer to a cuopt_float_t that on output will contain the objective offset.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetObjectiveCoefficients(
- cuOptOptimizationProblem problem,
- cuopt_float_t *objective_coefficients_ptr
Get the objective coefficients of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
objective_coefficients_ptr – [out] - A pointer to an array of type cuopt_float_t of size num_variables that on output will contain the objective coefficients.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetNumNonZeros(
- cuOptOptimizationProblem problem,
- cuopt_int_t *num_non_zeros_ptr
Get the number of non-zero elements in the constraint matrix of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
num_non_zeros_ptr – [out] - A pointer to a cuopt_int_t that on output will contain the number of non-zeros in the constraint matrix.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetConstraintMatrix(
- cuOptOptimizationProblem problem,
- cuopt_int_t *constraint_matrix_row_offsets_ptr,
- cuopt_int_t *constraint_matrix_column_indices_ptr,
- cuopt_float_t *constraint_matrix_coefficients_ptr
Get the constraint matrix of an optimization problem in compressed sparse row format.
- Parameters:
problem – [in] - The optimization problem.
constraint_matrix_row_offsets_ptr – [out] - A pointer to an array of type cuopt_int_t of size num_constraints + 1 that on output will contain the row offsets of the constraint matrix.
constraint_matrix_column_indices_ptr – [out] - A pointer to an array of type cuopt_int_t of size equal to the number of nonzeros that on output will contain the column indices of the non-zero entries of the constraint matrix.
constraint_matrix_coefficients_ptr – [out] - A pointer to an array of type cuopt_float_t of size equal to the number of nonzeros that on output will contain the coefficients of the non-zero entries of the constraint matrix.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetConstraintSense(
- cuOptOptimizationProblem problem,
- char *constraint_sense_ptr
Get the constraint sense of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
constraint_sense_ptr – [out] - A pointer to an array of type char of size num_constraints that on output will contain the sense of the constraints.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetConstraintRightHandSide(
- cuOptOptimizationProblem problem,
- cuopt_float_t *rhs_ptr
Get the right-hand side of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
rhs_ptr – [out] - A pointer to an array of type cuopt_float_t of size num_constraints that on output will contain the right-hand side of the constraints.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetConstraintLowerBounds(
- cuOptOptimizationProblem problem,
- cuopt_float_t *lower_bounds_ptr
Get the lower bounds of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
lower_bounds_ptr – [out] - A pointer to an array of type cuopt_float_t of size num_constraints that on output will contain the lower bounds of the constraints.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetConstraintUpperBounds(
- cuOptOptimizationProblem problem,
- cuopt_float_t *upper_bounds_ptr
Get the upper bounds of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
upper_bounds_ptr – [out] - A pointer to an array of type cuopt_float_t of size num_constraints that on output will contain the upper bounds of the constraints.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetVariableLowerBounds(
- cuOptOptimizationProblem problem,
- cuopt_float_t *lower_bounds_ptr
Get the lower bounds of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
lower_bounds_ptr – [out] - A pointer to an array of type cuopt_float_t of size num_variables that on output will contain the lower bounds of the variables.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetVariableUpperBounds(
- cuOptOptimizationProblem problem,
- cuopt_float_t *upper_bounds_ptr
Get the upper bounds of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
upper_bounds_ptr – [out] - A pointer to an array of type cuopt_float_t of size num_variables that on output will contain the upper bounds of the variables.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetVariableTypes(
- cuOptOptimizationProblem problem,
- char *variable_types_ptr
Get the variable types of an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
variable_types_ptr – [out] - A pointer to an array of type char of size num_variables that on output will contain the types of the variables (CUOPT_CONTINUOUS or CUOPT_INTEGER).
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptIsMIP(
- cuOptOptimizationProblem problem,
- cuopt_int_t *is_mip_ptr
Check if an optimization problem is a mixed integer programming problem.
- Parameters:
problem – [in] - The optimization problem.
is_mip_ptr – [out] - A pointer to a cuopt_int_t that on output will be 0 if the problem contains only continuous variables, or 1 if the problem contains integer variables.
- Returns:
A status code indicating success or failure.
Solver Settings#
Settings are used to configure the LP/MIP solvers. All settings are stored in a cuOptSolverSettings object.
-
typedef void *cuOptSolverSettings#
A
cuOptSolverSettings
object contains parameter settings and other information for an LP or MIP solve. It is created bycuOptCreateSolverSettings
. It is passed tocuOptSolve
. It should be destroyed usingcuOptDestroySolverSettings
.
A cuOptSolverSettings object is created with cuOptCreateSolverSettings
- cuopt_int_t cuOptCreateSolverSettings(
- cuOptSolverSettings *settings_ptr
Create a solver settings object.
- Parameters:
settings_ptr – [out] - A pointer to a cuOptSolverSettings object. On output the solver settings will be created and initialized.
- Returns:
A status code indicating success or failure.
When you are done with a solve you should destroy a cuOptSolverSettings object with
-
void cuOptDestroySolverSettings(cuOptSolverSettings *settings_ptr)#
Destroy a solver settings object.
- Parameters:
settings_ptr – [inout] - A pointer to a cuOptSolverSettings object. On output the solver settings will be destroyed and the pointer will be set to NULL.
Setting Parameters#
The following functions are used to set and get parameters. You can find more details on the available parameters in the LP/MILP settings section.
- cuopt_int_t cuOptSetParameter(
- cuOptSolverSettings settings,
- const char *parameter_name,
- const char *parameter_value
Set a parameter of a solver settings object.
- Parameters:
settings – [in] - The solver settings object.
parameter_name – [in] - The name of the parameter to set.
parameter_value – [in] - The value of the parameter to set.
- cuopt_int_t cuOptGetParameter(
- cuOptSolverSettings settings,
- const char *parameter_name,
- cuopt_int_t parameter_value_size,
- char *parameter_value
Get a parameter of a solver settings object.
- Parameters:
settings – [in] - The solver settings object.
parameter_name – [in] - The name of the parameter to get.
parameter_value_size – [in] - The size of the parameter value buffer.
parameter_value – [out] - A pointer to an array of characters that on output will contain the value of the parameter.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptSetIntegerParameter(
- cuOptSolverSettings settings,
- const char *parameter_name,
- cuopt_int_t parameter_value
Set an integer parameter of a solver settings object.
- Parameters:
settings – [in] - The solver settings object.
parameter_name – [in] - The name of the parameter to set.
parameter_value – [in] - The value of the parameter to set.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetIntegerParameter(
- cuOptSolverSettings settings,
- const char *parameter_name,
- cuopt_int_t *parameter_value
Get an integer parameter of a solver settings object.
- Parameters:
settings – [in] - The solver settings object.
parameter_name – [in] - The name of the parameter to get.
parameter_value – [out] - A pointer to a cuopt_int_t that on output will contain the value of the parameter.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptSetFloatParameter(
- cuOptSolverSettings settings,
- const char *parameter_name,
- cuopt_float_t parameter_value
Set a float parameter of a solver settings object.
- Parameters:
settings – [in] - The solver settings object.
parameter_name – [in] - The name of the parameter to set.
parameter_value – [in] - The value of the parameter to set.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetFloatParameter(
- cuOptSolverSettings settings,
- const char *parameter_name,
- cuopt_float_t *parameter_value
Get a float parameter of a solver settings object.
- Parameters:
settings – [in] - The solver settings object.
parameter_name – [in] - The name of the parameter to get.
parameter_value – [out] - A pointer to a cuopt_float_t that on output will contain the value of the parameter.
- Returns:
A status code indicating success or failure.
Parameter Constants#
These constants are used as the parameter name in the cuOptSetParameter , cuOptGetParameter and similar functions. More details on the parameters can be found in the LP/MILP settings section.
-
CUOPT_ABSOLUTE_DUAL_TOLERANCE#
-
CUOPT_RELATIVE_DUAL_TOLERANCE#
-
CUOPT_ABSOLUTE_PRIMAL_TOLERANCE#
-
CUOPT_RELATIVE_PRIMAL_TOLERANCE#
-
CUOPT_ABSOLUTE_GAP_TOLERANCE#
-
CUOPT_RELATIVE_GAP_TOLERANCE#
-
CUOPT_INFEASIBILITY_DETECTION#
-
CUOPT_STRICT_INFEASIBILITY#
-
CUOPT_PRIMAL_INFEASIBLE_TOLERANCE#
-
CUOPT_DUAL_INFEASIBLE_TOLERANCE#
-
CUOPT_ITERATION_LIMIT#
-
CUOPT_TIME_LIMIT#
-
CUOPT_PDLP_SOLVER_MODE#
-
CUOPT_METHOD#
-
CUOPT_PER_CONSTRAINT_RESIDUAL#
-
CUOPT_SAVE_BEST_PRIMAL_SO_FAR#
-
CUOPT_FIRST_PRIMAL_FEASIBLE#
-
CUOPT_LOG_FILE#
-
CUOPT_MIP_ABSOLUTE_TOLERANCE#
-
CUOPT_MIP_RELATIVE_TOLERANCE#
-
CUOPT_MIP_INTEGRALITY_TOLERANCE#
-
CUOPT_MIP_SCALING#
-
CUOPT_MIP_HEURISTICS_ONLY#
-
CUOPT_SOLUTION_FILE#
-
CUOPT_NUM_CPU_THREADS#
-
CUOPT_USER_PROBLEM_FILE#
PDLP Solver Mode Constants#
These constants are used to configure CUOPT_PDLP_SOLVER_MODE via cuOptSetIntegerParameter.
-
CUOPT_PDLP_SOLVER_MODE_STABLE1#
-
CUOPT_PDLP_SOLVER_MODE_STABLE2#
-
CUOPT_PDLP_SOLVER_MODE_METHODICAL1#
-
CUOPT_PDLP_SOLVER_MODE_FAST1#
Method Constants#
These constants are used to configure CUOPT_METHOD via cuOptSetIntegerParameter.
-
CUOPT_METHOD_CONCURRENT#
-
CUOPT_METHOD_PDLP#
-
CUOPT_METHOD_DUAL_SIMPLEX#
Solving an LP or MIP#
LP and MIP solves are performed by calling the cuOptSolve function
- cuopt_int_t cuOptSolve(
- cuOptOptimizationProblem problem,
- cuOptSolverSettings settings,
- cuOptSolution *solution_ptr
Solve an optimization problem.
- Parameters:
problem – [in] - The optimization problem.
settings – [in] - The solver settings.
solution_ptr – [out] - A pointer to a cuOptSolution object. On output the solution will be created.
- Returns:
A status code indicating success or failure.
Solution#
The output of a solve is a cuOptSolution object.
-
typedef void *cuOptSolution#
A
cuOptSolution
object contains the solution to an LP or MIP. It is created bycuOptSolve
. It should be destroyed usingcuOptDestroySolution
.
The following functions may be used to access information from a cuOptSolution
- cuopt_int_t cuOptGetTerminationStatus(
- cuOptSolution solution,
- cuopt_int_t *termination_status_ptr
Get the termination reason of an optimization problem.
- Parameters:
solution – [in] - The solution object.
termination_reason_ptr – [out] - A pointer to a cuopt_int_t that on output will contain the termination reason.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetPrimalSolution(
- cuOptSolution solution,
- cuopt_float_t *solution_values
- cuopt_int_t cuOptGetObjectiveValue(
- cuOptSolution solution,
- cuopt_float_t *objective_value_ptr
Get the objective value of an optimization problem.
- Parameters:
solution – [in] - The solution object.
objective_value_ptr – [inout] - A pointer to a cuopt_float_t that will contain the objective value.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetSolveTime(
- cuOptSolution solution,
- cuopt_float_t *solve_time_ptr
Get the solve time of an optimization problem.
- Parameters:
solution – [in] - The solution object.
solve_time_ptr – [inout] - A pointer to a cuopt_float_t that will contain the solve time.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetMIPGap(
- cuOptSolution solution,
- cuopt_float_t *mip_gap_ptr
Get the relative MIP gap of an optimization problem.
- Parameters:
solution – [in] - The solution object.
mip_gap_ptr – [inout] - A pointer to a cuopt_float_t that will contain the relative MIP gap.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetSolutionBound(
- cuOptSolution solution,
- cuopt_float_t *solution_bound_ptr
Get the solution bound of an optimization problem.
- Parameters:
solution – [in] - The solution object.
solution_bound_ptr – [inout] - A pointer to a cuopt_float_t that will contain the solution bound.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetDualSolution(
- cuOptSolution solution,
- cuopt_float_t *dual_solution_ptr
Get the dual solution of an optimization problem.
- Parameters:
solution – [in] - The solution object.
dual_solution_ptr – [inout] - A pointer to an array of type cuopt_float_t of size num_constraints that will contain the dual solution.
- Returns:
A status code indicating success or failure.
- cuopt_int_t cuOptGetReducedCosts(
- cuOptSolution solution,
- cuopt_float_t *reduced_cost_ptr
Get the reduced costs of an optimization problem.
- Parameters:
solution – [in] - The solution object.
reduced_cost_ptr – [inout] - A pointer to an array of type cuopt_float_t of size num_variables that will contain the reduced cost.
- Returns:
A status code indicating success or failure.
When you are finished with a cuOptSolution object you should destory it with
-
void cuOptDestroySolution(cuOptSolution *solution_ptr)#
Destroy a solution object.
- Parameters:
solution_ptr – [inout] - A pointer to a cuOptSolution object. On output the solution will be destroyed and the pointer will be set to NULL.
Termination Status Constants#
These constants define the termination status received from the cuOptGetTerminationStatus function.
-
CUOPT_TERIMINATION_STATUS_NO_TERMINATION#
-
CUOPT_TERIMINATION_STATUS_OPTIMAL#
-
CUOPT_TERIMINATION_STATUS_INFEASIBLE#
-
CUOPT_TERIMINATION_STATUS_UNBOUNDED#
-
CUOPT_TERIMINATION_STATUS_ITERATION_LIMIT#
-
CUOPT_TERIMINATION_STATUS_TIME_LIMIT#
-
CUOPT_TERIMINATION_STATUS_NUMERICAL_ERROR#
-
CUOPT_TERIMINATION_STATUS_PRIMAL_FEASIBLE#
-
CUOPT_TERIMINATION_STATUS_FEASIBLE_FOUND#
-
CUOPT_TERIMINATION_STATUS_CONCURRENT_LIMIT#