From 8b85cca04eab0f588c569f655c34ad6a88bb3d7f Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Fri, 30 Oct 2026 10:59:27 -0500 Subject: [PATCH 1/5] docs: fix C API examples and server abort/upload docs, document attribute APIs --- .../source/cuopt-c/convex/convex-c-api.rst | 79 ++++++++++++++++++- .../source/cuopt-c/convex/convex-examples.rst | 30 ++++--- .../convex/examples/simple_qp_example.c | 52 +++++++----- docs/cuopt/source/cuopt-c/mip/mip-c-api.rst | 9 +++ .../cuopt/source/cuopt-c/mip/mip-examples.rst | 16 ++-- .../cuopt-server/examples/milp-examples.rst | 4 +- .../milp/examples/abort_job_example.py | 11 +-- .../milp/examples/abort_job_example.sh | 4 +- .../examples/routing-examples.rst | 6 ++ 9 files changed, 156 insertions(+), 55 deletions(-) diff --git a/docs/cuopt/source/cuopt-c/convex/convex-c-api.rst b/docs/cuopt/source/cuopt-c/convex/convex-c-api.rst index 1c10fdbf71..e0cfde74f9 100644 --- a/docs/cuopt/source/cuopt-c/convex/convex-c-api.rst +++ b/docs/cuopt/source/cuopt-c/convex/convex-c-api.rst @@ -70,7 +70,7 @@ For problems with quadratic constraints, first create a problem, and then use Support for quadratic constraints is currently in **beta**. ``cuOptAddQuadraticConstraint`` supports three types of quadratic constraints: - **Convex quadratic constraints** of the form ``x^T Q x + d^T x <= alpha`` where ``H=(Q+Q^T)/2`` is a symmetric positive semidefinite matrix. `Q` need not be symmetric. - - **Second-order cone constraints** of the form ``sum_{i=1}^n x_i^2 <= x_0``, ``x_0 >= 0`` + - **Second-order cone constraints** of the form ``sum_{i=1}^n x_i^2 <= x_0^2``, ``x_0 >= 0`` - **Rotated second-order cone constraints** of the form ``sum_{i=2}^n x_i^2 - 2 * x_0 * x_1 <= 0``, ``x_0 >= 0``, ``x_1 >= 0`` (supply ``Q[x_0, x_1] = -2`` in COO, or ``-x_0*x_1`` for the ``<= x_0*x_1`` cone form; see :doc:`/convex-features`) Only ``CUOPT_LESS_THAN`` and ``CUOPT_GREATER_THAN`` sense is supported; equality constraints are not supported. @@ -134,6 +134,7 @@ The following functions may be used to get information about an `cuOptimizationP .. doxygenfunction:: cuOptGetNumNonZeros .. doxygenfunction:: cuOptGetConstraintMatrix .. doxygenfunction:: cuOptGetConstraintMatrixCSR +.. doxygenfunction:: cuOptGetConstraintMatrixCSC .. doxygenfunction:: cuOptGetConstraintSense .. doxygenfunction:: cuOptGetConstraintRightHandSide .. doxygenfunction:: cuOptGetConstraintLowerBounds @@ -143,6 +144,46 @@ The following functions may be used to get information about an `cuOptimizationP .. doxygenfunction:: cuOptGetVariableTypes .. doxygenfunction:: cuOptIsMIP +Problem attributes can also be queried by selector with the following functions. The selector constants +are listed in :ref:`problem-attribute-constants`. + +.. doxygenfunction:: cuOptGetProblemIntAttribute +.. doxygenfunction:: cuOptGetProblemFloatAttribute +.. doxygenfunction:: cuOptGetProblemCharArrayAttribute +.. doxygenfunction:: cuOptGetProblemFloatArrayAttribute +.. doxygenfunction:: cuOptGetProblemStringArrayAttribute + +.. _problem-attribute-constants: + +Problem Attribute Constants +--------------------------- + +These constants are the selectors passed to the ``cuOptGetProblem*Attribute`` functions. + +.. doxygendefine:: CUOPT_ATTR_NUM_VARIABLES +.. doxygendefine:: CUOPT_ATTR_NUM_CONSTRAINTS +.. doxygendefine:: CUOPT_ATTR_NUM_NONZEROS +.. doxygendefine:: CUOPT_ATTR_NUM_INTEGERS +.. doxygendefine:: CUOPT_ATTR_OBJECTIVE_SENSE +.. doxygendefine:: CUOPT_ATTR_OBJECTIVE_OFFSET +.. doxygendefine:: CUOPT_ATTR_OBJECTIVE_SCALING_FACTOR +.. doxygendefine:: CUOPT_ATTR_PROBLEM_CATEGORY +.. doxygendefine:: CUOPT_ATTR_IS_MIP +.. doxygendefine:: CUOPT_ATTR_HAS_QUADRATIC_OBJECTIVE +.. doxygendefine:: CUOPT_ATTR_HAS_QUADRATIC_CONSTRAINTS +.. doxygendefine:: CUOPT_ATTR_NUM_LINEAR_CONSTRAINTS +.. doxygendefine:: CUOPT_ATTR_NUM_QUADRATIC_CONSTRAINTS +.. doxygendefine:: CUOPT_ARRAY_ATTR_OBJECTIVE_COEFFICIENTS +.. doxygendefine:: CUOPT_ARRAY_ATTR_VARIABLE_LOWER_BOUNDS +.. doxygendefine:: CUOPT_ARRAY_ATTR_VARIABLE_UPPER_BOUNDS +.. doxygendefine:: CUOPT_ARRAY_ATTR_CONSTRAINT_LOWER_BOUNDS +.. doxygendefine:: CUOPT_ARRAY_ATTR_CONSTRAINT_UPPER_BOUNDS +.. doxygendefine:: CUOPT_ARRAY_ATTR_CONSTRAINT_RHS +.. doxygendefine:: CUOPT_ARRAY_ATTR_CONSTRAINT_SENSE +.. doxygendefine:: CUOPT_ARRAY_ATTR_VARIABLE_TYPES +.. doxygendefine:: CUOPT_STRING_ARRAY_VARIABLE_NAMES +.. doxygendefine:: CUOPT_STRING_ARRAY_ROW_NAMES + Solver Settings --------------- @@ -302,6 +343,16 @@ These constants are used to configure `CUOPT_MULTIGPU_PDLP_PARTITIONER` via :c:f .. _barrier-iterative-refinement-constants: +Presolve Constants +------------------ + +These constants are used to configure `CUOPT_PRESOLVE` via :c:func:`cuOptSetIntegerParameter`. + +.. doxygendefine:: CUOPT_PRESOLVE_DEFAULT +.. doxygendefine:: CUOPT_PRESOLVE_OFF +.. doxygendefine:: CUOPT_PRESOLVE_PAPILO +.. doxygendefine:: CUOPT_PRESOLVE_PSLP + Barrier Iterative Refinement Constants --------------------------------------- @@ -352,10 +403,36 @@ The following functions may be used to access information from a `cuOptSolution` .. doxygenfunction:: cuOptGetDualObjectiveValue .. doxygenfunction:: cuOptGetReducedCosts +Solution statistics can also be queried by selector with the following functions. The selector constants +are listed in :ref:`solution-attribute-constants`. + +.. doxygenfunction:: cuOptGetSolutionIntAttribute +.. doxygenfunction:: cuOptGetSolutionFloatAttribute + When you are finished with a `cuOptSolution` object you should destory it with .. doxygenfunction:: cuOptDestroySolution +.. _solution-attribute-constants: + +Solution Attribute Constants +---------------------------- + +These constants are the selectors passed to the ``cuOptGetSolution*Attribute`` functions. A selector that +does not apply to the problem class that produced the solution returns ``CUOPT_INVALID_ARGUMENT``. + +.. doxygendefine:: CUOPT_SOLUTION_ATTR_LP_PRIMAL_RESIDUAL +.. doxygendefine:: CUOPT_SOLUTION_ATTR_LP_DUAL_RESIDUAL +.. doxygendefine:: CUOPT_SOLUTION_ATTR_LP_GAP +.. doxygendefine:: CUOPT_SOLUTION_ATTR_LP_NUM_ITERATIONS +.. doxygendefine:: CUOPT_SOLUTION_ATTR_LP_SOLVED_BY +.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_PRESOLVE_TIME +.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_NUM_NODES +.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_NUM_SIMPLEX_ITERATIONS +.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_MAX_CONSTRAINT_VIOLATION +.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_MAX_INT_VIOLATION +.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_MAX_VARIABLE_BOUND_VIOLATION + Termination Status Constants ---------------------------- diff --git a/docs/cuopt/source/cuopt-c/convex/convex-examples.rst b/docs/cuopt/source/cuopt-c/convex/convex-examples.rst index 6df2a9e267..64cba2c30f 100644 --- a/docs/cuopt/source/cuopt-c/convex/convex-examples.rst +++ b/docs/cuopt/source/cuopt-c/convex/convex-examples.rst @@ -8,7 +8,7 @@ LP Example with Data This example demonstrates how to use the LP solver in C. More details on the API can be found in :doc:`C API `. -The example code is available at ``examples/cuopt-c/lp/simple_lp_example.c`` (:download:`download `): +The example code is available at ``docs/cuopt/source/cuopt-c/convex/examples/simple_lp_example.c`` (:download:`download `): .. literalinclude:: examples/simple_lp_example.c :language: c @@ -19,12 +19,16 @@ The following commands are for Linux and might fail in cases where the cuopt lib If you have built it locally, libcuopt.so will be in the build directory ``cpp/build`` and include directoy would be ``cpp/include``. +.. note:: + + ``-lcuopt`` requires all of the cuOpt libraries to be installed (the ``libcuopt`` package). With only the split packages installed, link ``-lcuopt_mathopt -lcuopt_client`` instead. + .. code-block:: bash # Find the cuopt header file and assign to INCLUDE_PATH - INCLUDE_PATH=$(find / -name "cuopt_c.h" -path "*/linear_programming/*" -printf "%h\n" | sed 's/\/linear_programming//' 2>/dev/null) - # Find the libcuopt library and assign to LIBCUOPT_LIBRARY_PATH - LIBCUOPT_LIBRARY_PATH=$(find / -name "libcuopt.so" 2>/dev/null) + INCLUDE_PATH=$(find / -name "cuopt_c.h" -path "*/mathematical_optimization/*" -printf "%h\n" 2>/dev/null | head -1 | sed 's/\/cuopt\/mathematical_optimization$//') + # Find the libcuopt library directory and assign to LIBCUOPT_LIBRARY_PATH + LIBCUOPT_LIBRARY_PATH=$(dirname $(find / -name "libcuopt.so" 2>/dev/null | head -1)) Build and run the example @@ -79,7 +83,7 @@ format is dispatched from the filename extension (case-insensitive): their ``.gz`` / ``.bz2`` variants → MPS parser. Unknown extensions are rejected. See :ref:`lp-file-example-c` for an LP counterpart. -The example code is available at ``examples/cuopt-c/lp/mps_file_example.c`` (:download:`download `): +The example code is available at ``docs/cuopt/source/cuopt-c/convex/examples/mps_file_example.c`` (:download:`download `): .. literalinclude:: examples/mps_file_example.c :language: c @@ -93,9 +97,9 @@ If you have built it locally, libcuopt.so will be in the build directory ``cpp/b .. code-block:: bash # Find the cuopt header file and assign to INCLUDE_PATH - INCLUDE_PATH=$(find / -name "cuopt_c.h" -path "*/linear_programming/*" -printf "%h\n" | sed 's/\/linear_programming//' 2>/dev/null) - # Find the libcuopt library and assign to LIBCUOPT_LIBRARY_PATH - LIBCUOPT_LIBRARY_PATH=$(find / -name "libcuopt.so" 2>/dev/null) + INCLUDE_PATH=$(find / -name "cuopt_c.h" -path "*/mathematical_optimization/*" -printf "%h\n" 2>/dev/null | head -1 | sed 's/\/cuopt\/mathematical_optimization$//') + # Find the libcuopt library directory and assign to LIBCUOPT_LIBRARY_PATH + LIBCUOPT_LIBRARY_PATH=$(dirname $(find / -name "libcuopt.so" 2>/dev/null | head -1)) A sample MPS file (:download:`download sample.mps `): @@ -157,7 +161,7 @@ rejected. See the ``read_lp`` declaration in ``cuopt/mathematical_optimization/io/parser.hpp`` for the supported subset of the LP format. -The example code is available at ``examples/cuopt-c/lp/lp_file_example.c`` (:download:`download `): +The example code is available at ``docs/cuopt/source/cuopt-c/convex/examples/lp_file_example.c`` (:download:`download `): .. literalinclude:: examples/lp_file_example.c :language: c @@ -187,7 +191,7 @@ Simple Quadratic Programming Example This example demonstrates how to use the cuOpt C API for quadratic programming. -The example code is available at ``examples/cuopt-c/lp/simple_qp_example.c`` (:download:`download `): +The example code is available at ``docs/cuopt/source/cuopt-c/convex/examples/simple_qp_example.c`` (:download:`download `): .. literalinclude:: examples/simple_qp_example.c :language: c @@ -227,7 +231,7 @@ Simple Second-Order Cone Programming Example This example builds an SOCP directly with the C API: a linear problem is created with :c:func:`cuOptCreateProblem`, then a second-order cone constraint is added with :c:func:`cuOptAddQuadraticConstraint`. It minimizes ``x3`` subject to ``x1 + x2 >= 2`` and the cone ``||(x1, x2)||_2 <= x3``, written as the quadratic inequality ``x1^2 + x2^2 - x3^2 <= 0``. cuOpt detects the second-order cone structure and solves with the barrier method. -The example code is available at ``examples/cuopt-c/lp/simple_socp_example.c`` (:download:`download `): +The example code is available at ``docs/cuopt/source/cuopt-c/convex/examples/simple_socp_example.c`` (:download:`download `): .. literalinclude:: examples/simple_socp_example.c :language: c @@ -273,7 +277,7 @@ cone ``x1^2 + x2^2 <= x3*x4`` is expressed as ``x1^2 + x2^2 - x3*x4 <= 0``. See for other RSOC forms. It minimizes ``x3 + x4`` subject to ``x1 + x2 >= 2`` and the rotated cone. -The example code is available at ``examples/cuopt-c/lp/rotated_socp_example.c`` (:download:`download `): +The example code is available at ``docs/cuopt/source/cuopt-c/convex/examples/rotated_socp_example.c`` (:download:`download `): .. literalinclude:: examples/rotated_socp_example.c :language: c @@ -320,7 +324,7 @@ This example adds a general convex quadratic constraint with ``2*x^2 + 2*x*y + 2*y^2 <= 6``. Note that the quadratic matrix Q that encodes this constraint need not be symmetric. Here the term ``2*x*y`` is supplied as a single entry ``Q[0,1] = 2``. -The example code is available at ``examples/cuopt-c/lp/general_quadratic_example.c`` (:download:`download `): +The example code is available at ``docs/cuopt/source/cuopt-c/convex/examples/general_quadratic_example.c`` (:download:`download `): .. literalinclude:: examples/general_quadratic_example.c :language: c diff --git a/docs/cuopt/source/cuopt-c/convex/examples/simple_qp_example.c b/docs/cuopt/source/cuopt-c/convex/examples/simple_qp_example.c index 2b3de3ae7c..3f5837e33d 100644 --- a/docs/cuopt/source/cuopt-c/convex/examples/simple_qp_example.c +++ b/docs/cuopt/source/cuopt-c/convex/examples/simple_qp_example.c @@ -83,13 +83,14 @@ cuopt_int_t test_simple_qp() // 0 is the coefficient of the linear term on y cuopt_float_t linear_objective_coefficients[] = {0.0, 0.0}; - // Quadratic objective matrix + // Quadratic objective matrix in coordinate (triplet) format // From the objective function: minimize x^2 + y^2 // 1 is the coefficient of the quadratic term on x^2 // 1 is the coefficient of the quadratic term on y^2 - cuopt_float_t quadratic_objective_matrix_values[] = {1.0, 1.0}; - cuopt_int_t quadratic_objective_matrix_row_offsets[] = {0, 1, 2}; - cuopt_int_t quadratic_objective_matrix_column_indices[] = {0, 1}; + cuopt_int_t quadratic_num_entries = 2; + cuopt_int_t quadratic_objective_row_indices[] = {0, 1}; + cuopt_int_t quadratic_objective_column_indices[] = {0, 1}; + cuopt_float_t quadratic_objective_values[] = {1.0, 1.0}; // Constraint bounds // From the constraints: @@ -115,28 +116,37 @@ cuopt_int_t test_simple_qp() printf("Creating and solving simple QP problem...\n"); - // Create the problem - status = cuOptCreateQuadraticProblem(num_constraints, - num_variables, - CUOPT_MINIMIZE, - 0.0, // objective offset - linear_objective_coefficients, - quadratic_objective_matrix_row_offsets, - quadratic_objective_matrix_column_indices, - quadratic_objective_matrix_values, - row_offsets, - column_indices, - values, - constraint_sense, - constraint_rhs, - var_lower_bounds, - var_upper_bounds, - &problem); + // Create the problem with its linear data + status = cuOptCreateProblem(num_constraints, + num_variables, + CUOPT_MINIMIZE, + 0.0, // objective offset + linear_objective_coefficients, + row_offsets, + column_indices, + values, + constraint_sense, + constraint_rhs, + var_lower_bounds, + var_upper_bounds, + variable_types, + &problem); if (status != CUOPT_SUCCESS) { printf("Error creating problem: %d\n", status); goto DONE; } + // Set the quadratic objective + status = cuOptSetQuadraticObjective(problem, + quadratic_num_entries, + quadratic_objective_row_indices, + quadratic_objective_column_indices, + quadratic_objective_values); + if (status != CUOPT_SUCCESS) { + printf("Error setting quadratic objective: %d\n", status); + goto DONE; + } + // Create solver settings status = cuOptCreateSolverSettings(&settings); if (status != CUOPT_SUCCESS) { diff --git a/docs/cuopt/source/cuopt-c/mip/mip-c-api.rst b/docs/cuopt/source/cuopt-c/mip/mip-c-api.rst index ee2e7b1447..56d59187bb 100644 --- a/docs/cuopt/source/cuopt-c/mip/mip-c-api.rst +++ b/docs/cuopt/source/cuopt-c/mip/mip-c-api.rst @@ -77,3 +77,12 @@ These constants are used to configure `CUOPT_MIP_DETERMINISM_MODE` via :c:func:` .. doxygendefine:: CUOPT_MODE_OPPORTUNISTIC .. doxygendefine:: CUOPT_MODE_DETERMINISTIC + +MIP Scaling Constants +--------------------- + +These constants are used to configure `CUOPT_MIP_SCALING` via :c:func:`cuOptSetIntegerParameter`. + +.. doxygendefine:: CUOPT_MIP_SCALING_OFF +.. doxygendefine:: CUOPT_MIP_SCALING_ON +.. doxygendefine:: CUOPT_MIP_SCALING_NO_OBJECTIVE diff --git a/docs/cuopt/source/cuopt-c/mip/mip-examples.rst b/docs/cuopt/source/cuopt-c/mip/mip-examples.rst index 624e4b001a..83fad24721 100644 --- a/docs/cuopt/source/cuopt-c/mip/mip-examples.rst +++ b/docs/cuopt/source/cuopt-c/mip/mip-examples.rst @@ -7,7 +7,7 @@ Example with Data This example demonstrates how to use the MIP solver in C. More details on the API can be found in :doc:`MIP C API `. -The example code is available at ``../lp-milp/examples/simple_milp_example.c`` (:download:`download `): +The example code is available at ``docs/cuopt/source/cuopt-c/mip/examples/simple_milp_example.c`` (:download:`download `): .. literalinclude:: examples/simple_milp_example.c :language: c @@ -18,12 +18,16 @@ The following commands are for Linux and might fail in cases where the cuopt lib If you have built it locally, libcuopt.so will be in the build directory ``cpp/build`` and include directoy would be ``cpp/include``. +.. note:: + + ``-lcuopt`` requires all of the cuOpt libraries to be installed (the ``libcuopt`` package). With only the split packages installed, link ``-lcuopt_mathopt -lcuopt_client`` instead. + .. code-block:: bash # Find the cuopt header file and assign to INCLUDE_PATH - INCLUDE_PATH=$(find / -name "cuopt_c.h" -path "*/linear_programming/*" -printf "%h\n" | sed 's/\/linear_programming//' 2>/dev/null) + INCLUDE_PATH=$(find / -name "cuopt_c.h" -path "*/mathematical_optimization/*" -printf "%h\n" 2>/dev/null | head -1 | sed 's/\/cuopt\/mathematical_optimization$//') # Find the libcuopt library directory and assign to LIBCUOPT_LIBRARY_PATH - LIBCUOPT_LIBRARY_PATH=$(dirname $(find / -name "libcuopt.so" 2>/dev/null)) + LIBCUOPT_LIBRARY_PATH=$(dirname $(find / -name "libcuopt.so" 2>/dev/null | head -1)) Build and run the example @@ -80,7 +84,7 @@ Example with MPS File This example demonstrates how to use the cuOpt solver in C to solve an MPS file. -The example code is available at ``examples/milp_mps_example.c`` (:download:`download `): +The example code is available at ``docs/cuopt/source/cuopt-c/mip/examples/milp_mps_example.c`` (:download:`download `): .. literalinclude:: examples/milp_mps_example.c :language: c @@ -94,9 +98,9 @@ If you have built it locally, libcuopt.so will be in the build directory ``cpp/b .. code-block:: bash # Find the cuopt header file and assign to INCLUDE_PATH - INCLUDE_PATH=$(find / -name "cuopt_c.h" -path "*/linear_programming/*" -printf "%h\n" | sed 's/\/linear_programming//' 2>/dev/null) + INCLUDE_PATH=$(find / -name "cuopt_c.h" -path "*/mathematical_optimization/*" -printf "%h\n" 2>/dev/null | head -1 | sed 's/\/cuopt\/mathematical_optimization$//') # Find the libcuopt library directory and assign to LIBCUOPT_LIBRARY_PATH - LIBCUOPT_LIBRARY_PATH=$(dirname $(find / -name "libcuopt.so" 2>/dev/null)) + LIBCUOPT_LIBRARY_PATH=$(dirname $(find / -name "libcuopt.so" 2>/dev/null | head -1)) A sample MIP MPS file (:download:`download mip_sample.mps `): diff --git a/docs/cuopt/source/cuopt-server/examples/milp-examples.rst b/docs/cuopt/source/cuopt-server/examples/milp-examples.rst index 8eef2d51a6..322ef969fc 100644 --- a/docs/cuopt/source/cuopt-server/examples/milp-examples.rst +++ b/docs/cuopt/source/cuopt-server/examples/milp-examples.rst @@ -217,11 +217,11 @@ Aborting a Running Job In CLI UUID that is returned by the solver while the solver is trying to find a solution so users can come back and check the status or query for results. -This aborts a job with UUID if it's in running state. +This aborts a job with UUID if it's queued or running. .. code-block:: bash # Please update ip and port if the server is running on a different IP address or port export ip="localhost" export port=5000 - cuopt_sh -d -r -q -i $ip -p $port + cuopt_sh -d -i $ip -p $port diff --git a/docs/cuopt/source/cuopt-server/examples/milp/examples/abort_job_example.py b/docs/cuopt/source/cuopt-server/examples/milp/examples/abort_job_example.py index f08b5f6b7e..1abeaacda1 100644 --- a/docs/cuopt/source/cuopt-server/examples/milp/examples/abort_job_example.py +++ b/docs/cuopt/source/cuopt-server/examples/milp/examples/abort_job_example.py @@ -34,15 +34,8 @@ def main(): ip="localhost", port=5000 ) - # Delete the job if it is still queued or running - # Parameters: - # - job_uuid: The UUID of the job to abort - # - running=True: Abort if the job is currently running - # - queued=True: Abort if the job is in the queue - # - cached=False: Don't delete from cache (only abort active/queued jobs) - response = cuopt_service_client.delete( - job_uuid, running=True, queued=True, cached=False - ) + # Abort the job if it is still queued or running + response = cuopt_service_client.delete(job_uuid) print(f"Response: {response}") diff --git a/docs/cuopt/source/cuopt-server/examples/milp/examples/abort_job_example.sh b/docs/cuopt/source/cuopt-server/examples/milp/examples/abort_job_example.sh index 95082aee0d..dfac2bc873 100755 --- a/docs/cuopt/source/cuopt-server/examples/milp/examples/abort_job_example.sh +++ b/docs/cuopt/source/cuopt-server/examples/milp/examples/abort_job_example.sh @@ -27,9 +27,7 @@ echo "Aborting job with UUID: $UUID" # Abort the job # -d: Delete/abort -# -r: If running -# -q: If queued -cuopt_sh -d -r -q $UUID -i $ip -p $port +cuopt_sh -d $UUID -i $ip -p $port echo "Job abort request sent" echo "" diff --git a/docs/cuopt/source/cuopt-server/examples/routing-examples.rst b/docs/cuopt/source/cuopt-server/examples/routing-examples.rst index fdef42f318..e3b4c1a2ea 100644 --- a/docs/cuopt/source/cuopt-server/examples/routing-examples.rst +++ b/docs/cuopt/source/cuopt-server/examples/routing-examples.rst @@ -76,6 +76,9 @@ Initial Solution Previously run solutions or uploaded solutions can be used as the initial solution for new requests using previously run reqIds as follows: +.. note:: + This example uploads a solution, which is only supported by the :ref:`legacy HTTP server `. The HTTP proxy server returns 501 for uploaded solutions. See :ref:`legacy-http-differences`. + :download:`initial_solution_example.py ` .. literalinclude:: routing/examples/initial_solution_example.py @@ -255,6 +258,9 @@ Uploading a Solution Users can also upload a solution which might have been saved for later runs. +.. note:: + Uploaded solutions are only supported by the :ref:`legacy HTTP server `. The HTTP proxy server returns 501. See :ref:`legacy-http-differences`. + .. code-block:: shell # Please update ip and port if the server is running on a different IP address or port From 3e3e3588dcfe12337d2c094fadf7f29f38019845 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Mon, 2 Nov 2026 15:36:45 -0600 Subject: [PATCH 2/5] docs: drop attribute API docs, fix barrier anchor, drop split-package note Remove the problem and solution attribute functions and selector lists from the C API reference, restore the barrier constants anchor to its own heading, and drop the -lcuopt note that the example commands did not follow. Co-Authored-By: Claude Sonnet 5.5 --- .../source/cuopt-c/convex/convex-c-api.rst | 70 +------------------ .../source/cuopt-c/convex/convex-examples.rst | 4 -- .../cuopt/source/cuopt-c/mip/mip-examples.rst | 4 -- 3 files changed, 2 insertions(+), 76 deletions(-) diff --git a/docs/cuopt/source/cuopt-c/convex/convex-c-api.rst b/docs/cuopt/source/cuopt-c/convex/convex-c-api.rst index e0cfde74f9..1a67a71764 100644 --- a/docs/cuopt/source/cuopt-c/convex/convex-c-api.rst +++ b/docs/cuopt/source/cuopt-c/convex/convex-c-api.rst @@ -144,46 +144,6 @@ The following functions may be used to get information about an `cuOptimizationP .. doxygenfunction:: cuOptGetVariableTypes .. doxygenfunction:: cuOptIsMIP -Problem attributes can also be queried by selector with the following functions. The selector constants -are listed in :ref:`problem-attribute-constants`. - -.. doxygenfunction:: cuOptGetProblemIntAttribute -.. doxygenfunction:: cuOptGetProblemFloatAttribute -.. doxygenfunction:: cuOptGetProblemCharArrayAttribute -.. doxygenfunction:: cuOptGetProblemFloatArrayAttribute -.. doxygenfunction:: cuOptGetProblemStringArrayAttribute - -.. _problem-attribute-constants: - -Problem Attribute Constants ---------------------------- - -These constants are the selectors passed to the ``cuOptGetProblem*Attribute`` functions. - -.. doxygendefine:: CUOPT_ATTR_NUM_VARIABLES -.. doxygendefine:: CUOPT_ATTR_NUM_CONSTRAINTS -.. doxygendefine:: CUOPT_ATTR_NUM_NONZEROS -.. doxygendefine:: CUOPT_ATTR_NUM_INTEGERS -.. doxygendefine:: CUOPT_ATTR_OBJECTIVE_SENSE -.. doxygendefine:: CUOPT_ATTR_OBJECTIVE_OFFSET -.. doxygendefine:: CUOPT_ATTR_OBJECTIVE_SCALING_FACTOR -.. doxygendefine:: CUOPT_ATTR_PROBLEM_CATEGORY -.. doxygendefine:: CUOPT_ATTR_IS_MIP -.. doxygendefine:: CUOPT_ATTR_HAS_QUADRATIC_OBJECTIVE -.. doxygendefine:: CUOPT_ATTR_HAS_QUADRATIC_CONSTRAINTS -.. doxygendefine:: CUOPT_ATTR_NUM_LINEAR_CONSTRAINTS -.. doxygendefine:: CUOPT_ATTR_NUM_QUADRATIC_CONSTRAINTS -.. doxygendefine:: CUOPT_ARRAY_ATTR_OBJECTIVE_COEFFICIENTS -.. doxygendefine:: CUOPT_ARRAY_ATTR_VARIABLE_LOWER_BOUNDS -.. doxygendefine:: CUOPT_ARRAY_ATTR_VARIABLE_UPPER_BOUNDS -.. doxygendefine:: CUOPT_ARRAY_ATTR_CONSTRAINT_LOWER_BOUNDS -.. doxygendefine:: CUOPT_ARRAY_ATTR_CONSTRAINT_UPPER_BOUNDS -.. doxygendefine:: CUOPT_ARRAY_ATTR_CONSTRAINT_RHS -.. doxygendefine:: CUOPT_ARRAY_ATTR_CONSTRAINT_SENSE -.. doxygendefine:: CUOPT_ARRAY_ATTR_VARIABLE_TYPES -.. doxygendefine:: CUOPT_STRING_ARRAY_VARIABLE_NAMES -.. doxygendefine:: CUOPT_STRING_ARRAY_ROW_NAMES - Solver Settings --------------- @@ -341,8 +301,6 @@ These constants are used to configure `CUOPT_MULTIGPU_PDLP_PARTITIONER` via :c:f .. doxygendefine:: CUOPT_MULTIGPU_PDLP_PARTITIONER_KAMINPAR .. doxygendefine:: CUOPT_MULTIGPU_PDLP_PARTITIONER_ROUND_ROBIN -.. _barrier-iterative-refinement-constants: - Presolve Constants ------------------ @@ -353,6 +311,8 @@ These constants are used to configure `CUOPT_PRESOLVE` via :c:func:`cuOptSetInte .. doxygendefine:: CUOPT_PRESOLVE_PAPILO .. doxygendefine:: CUOPT_PRESOLVE_PSLP +.. _barrier-iterative-refinement-constants: + Barrier Iterative Refinement Constants --------------------------------------- @@ -403,36 +363,10 @@ The following functions may be used to access information from a `cuOptSolution` .. doxygenfunction:: cuOptGetDualObjectiveValue .. doxygenfunction:: cuOptGetReducedCosts -Solution statistics can also be queried by selector with the following functions. The selector constants -are listed in :ref:`solution-attribute-constants`. - -.. doxygenfunction:: cuOptGetSolutionIntAttribute -.. doxygenfunction:: cuOptGetSolutionFloatAttribute - When you are finished with a `cuOptSolution` object you should destory it with .. doxygenfunction:: cuOptDestroySolution -.. _solution-attribute-constants: - -Solution Attribute Constants ----------------------------- - -These constants are the selectors passed to the ``cuOptGetSolution*Attribute`` functions. A selector that -does not apply to the problem class that produced the solution returns ``CUOPT_INVALID_ARGUMENT``. - -.. doxygendefine:: CUOPT_SOLUTION_ATTR_LP_PRIMAL_RESIDUAL -.. doxygendefine:: CUOPT_SOLUTION_ATTR_LP_DUAL_RESIDUAL -.. doxygendefine:: CUOPT_SOLUTION_ATTR_LP_GAP -.. doxygendefine:: CUOPT_SOLUTION_ATTR_LP_NUM_ITERATIONS -.. doxygendefine:: CUOPT_SOLUTION_ATTR_LP_SOLVED_BY -.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_PRESOLVE_TIME -.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_NUM_NODES -.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_NUM_SIMPLEX_ITERATIONS -.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_MAX_CONSTRAINT_VIOLATION -.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_MAX_INT_VIOLATION -.. doxygendefine:: CUOPT_SOLUTION_ATTR_MIP_MAX_VARIABLE_BOUND_VIOLATION - Termination Status Constants ---------------------------- diff --git a/docs/cuopt/source/cuopt-c/convex/convex-examples.rst b/docs/cuopt/source/cuopt-c/convex/convex-examples.rst index 64cba2c30f..2ded010099 100644 --- a/docs/cuopt/source/cuopt-c/convex/convex-examples.rst +++ b/docs/cuopt/source/cuopt-c/convex/convex-examples.rst @@ -19,10 +19,6 @@ The following commands are for Linux and might fail in cases where the cuopt lib If you have built it locally, libcuopt.so will be in the build directory ``cpp/build`` and include directoy would be ``cpp/include``. -.. note:: - - ``-lcuopt`` requires all of the cuOpt libraries to be installed (the ``libcuopt`` package). With only the split packages installed, link ``-lcuopt_mathopt -lcuopt_client`` instead. - .. code-block:: bash # Find the cuopt header file and assign to INCLUDE_PATH diff --git a/docs/cuopt/source/cuopt-c/mip/mip-examples.rst b/docs/cuopt/source/cuopt-c/mip/mip-examples.rst index 83fad24721..74f65d3642 100644 --- a/docs/cuopt/source/cuopt-c/mip/mip-examples.rst +++ b/docs/cuopt/source/cuopt-c/mip/mip-examples.rst @@ -18,10 +18,6 @@ The following commands are for Linux and might fail in cases where the cuopt lib If you have built it locally, libcuopt.so will be in the build directory ``cpp/build`` and include directoy would be ``cpp/include``. -.. note:: - - ``-lcuopt`` requires all of the cuOpt libraries to be installed (the ``libcuopt`` package). With only the split packages installed, link ``-lcuopt_mathopt -lcuopt_client`` instead. - .. code-block:: bash # Find the cuopt header file and assign to INCLUDE_PATH From f283e1881913ff95939b4b96efdb002cb2614440 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu <42624703+ramakrishnap-nv@users.noreply.github.com> Date: Wed, 4 Nov 2026 09:26:07 -0600 Subject: [PATCH 3/5] Update simple_qp_example.c --- docs/cuopt/source/cuopt-c/convex/examples/simple_qp_example.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cuopt/source/cuopt-c/convex/examples/simple_qp_example.c b/docs/cuopt/source/cuopt-c/convex/examples/simple_qp_example.c index 3f5837e33d..7571a5b75c 100644 --- a/docs/cuopt/source/cuopt-c/convex/examples/simple_qp_example.c +++ b/docs/cuopt/source/cuopt-c/convex/examples/simple_qp_example.c @@ -83,7 +83,7 @@ cuopt_int_t test_simple_qp() // 0 is the coefficient of the linear term on y cuopt_float_t linear_objective_coefficients[] = {0.0, 0.0}; - // Quadratic objective matrix in coordinate (triplet) format + // Quadratic objective matrix in COO format // From the objective function: minimize x^2 + y^2 // 1 is the coefficient of the quadratic term on x^2 // 1 is the coefficient of the quadratic term on y^2 From dfd03b74fea07d5fdabbf5f755e2ef232441550e Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Thu, 5 Nov 2026 11:06:25 -0600 Subject: [PATCH 4/5] docs: reference cuOptGetNumVariables in the CSC getter comment cuOptGetProblemIntAttribute is not part of the published API docs, so the reference rendered as a dangling name. cuOptGetNumVariables is documented and gives the same value. Co-Authored-By: Claude Sonnet 5.5 Signed-off-by: Ramakrishna Prabhu --- cpp/include/cuopt/mathematical_optimization/cuopt_c.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/include/cuopt/mathematical_optimization/cuopt_c.h b/cpp/include/cuopt/mathematical_optimization/cuopt_c.h index 2fdcbe84f4..0f7b30fc56 100644 --- a/cpp/include/cuopt/mathematical_optimization/cuopt_c.h +++ b/cpp/include/cuopt/mathematical_optimization/cuopt_c.h @@ -623,8 +623,8 @@ cuopt_int_t cuOptGetConstraintMatrixCSR(cuOptOptimizationProblem problem, * @param[in] problem - The optimization problem. * * @param[out] constraint_matrix_column_offsets_ptr - A pointer to an array of type cuopt_int_t of - * size num_variables + 1 (see cuOptGetProblemIntAttribute) that on output will contain the column - * offsets of the constraint matrix. + * size num_variables + 1 (see cuOptGetNumVariables) that on output will contain the column offsets + * of the constraint matrix. * * @param[out] constraint_matrix_row_indices_ptr - A pointer to an array of type cuopt_int_t of size * equal to the number of nonzeros (see cuOptGetNumNonZeros) that on output will contain the row From 832940b5acfeea3ad86d42e8d7472ce962972026 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Thu, 5 Nov 2026 14:12:09 -0600 Subject: [PATCH 5/5] docs: drop the cross-reference from the CSC getter comment Co-Authored-By: Claude Sonnet 5.5 Signed-off-by: Ramakrishna Prabhu --- cpp/include/cuopt/mathematical_optimization/cuopt_c.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/include/cuopt/mathematical_optimization/cuopt_c.h b/cpp/include/cuopt/mathematical_optimization/cuopt_c.h index 0f7b30fc56..643918655b 100644 --- a/cpp/include/cuopt/mathematical_optimization/cuopt_c.h +++ b/cpp/include/cuopt/mathematical_optimization/cuopt_c.h @@ -623,8 +623,8 @@ cuopt_int_t cuOptGetConstraintMatrixCSR(cuOptOptimizationProblem problem, * @param[in] problem - The optimization problem. * * @param[out] constraint_matrix_column_offsets_ptr - A pointer to an array of type cuopt_int_t of - * size num_variables + 1 (see cuOptGetNumVariables) that on output will contain the column offsets - * of the constraint matrix. + * size num_variables + 1 that on output will contain the column offsets of the constraint + * matrix. * * @param[out] constraint_matrix_row_indices_ptr - A pointer to an array of type cuopt_int_t of size * equal to the number of nonzeros (see cuOptGetNumNonZeros) that on output will contain the row