Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions ci/test_self_hosted_service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ if [ "$doservertest" -eq 1 ]; then
run_cli_test "'status': 0" cuopt_sh -s -c "$CLIENT_CERT" -p $CUOPT_SERVER_PORT -f cuopt_problem_data.json

# Success, small LP problem with pure JSON
run_cli_test "'status': 1" cuopt_sh -s -c "$CLIENT_CERT" -p $CUOPT_SERVER_PORT -t LP ../../datasets/cuopt_service_data/good_lp.json
run_cli_test "'status': 'Optimal'" cuopt_sh -s -c "$CLIENT_CERT" -p $CUOPT_SERVER_PORT -t LP ../../datasets/cuopt_service_data/good_lp.json

# Success, small MILP problem with pure JSON which returns a solution with Optimal status
run_cli_test "'status': 1" cuopt_sh -s -c $CLIENT_CERT -p $CUOPT_SERVER_PORT -t LP ../../datasets/mixed_integer_programming/milp_data.json
run_cli_test "'status': 'Optimal'" cuopt_sh -s -c $CLIENT_CERT -p $CUOPT_SERVER_PORT -t LP ../../datasets/mixed_integer_programming/milp_data.json

# Succes, small LP problem with mps. Data will be transformed to JSON
run_cli_test "'status': 1" cuopt_sh -s -c "$CLIENT_CERT" -p $CUOPT_SERVER_PORT -t LP ../../datasets/linear_programming/good-mps-1.mps
run_cli_test "'status': 'Optimal'" cuopt_sh -s -c "$CLIENT_CERT" -p $CUOPT_SERVER_PORT -t LP ../../datasets/linear_programming/good-mps-1.mps

# Succes, small Batch LP problem with mps. Data will be transformed to JSON
run_cli_test "'status': 1" cuopt_sh -s -c "$CLIENT_CERT" -p $CUOPT_SERVER_PORT -t LP ../../datasets/linear_programming/good-mps-1.mps ../../datasets/linear_programming/good-mps-1.mps
run_cli_test "'status': 'Optimal'" cuopt_sh -s -c "$CLIENT_CERT" -p $CUOPT_SERVER_PORT -t LP ../../datasets/linear_programming/good-mps-1.mps ../../datasets/linear_programming/good-mps-1.mps

# Error, local file mode is not allowed with mps
run_cli_test "Cannot use local file mode with MPS data" cuopt_sh -s -c "$CLIENT_CERT" -p $CUOPT_SERVER_PORT -t LP -f good-mps-1.mps
Expand Down Expand Up @@ -166,8 +166,8 @@ if [ "$doservertest" -eq 1 ]; then
run_cli_test "Check for status with the following command" cuopt_sh -s -c "$CLIENT_CERT" -p "$CUOPT_SERVER_PORT" -pt 0 ../../datasets/cuopt_service_data/good_lp.json -k
requestid=$(echo "$cli_test" | tail -1)
requestid=$(echo ${requestid#cuopt_sh } | sed "s/-p $CUOPT_SERVER_PORT//g" | tr -d "'" | tr -d " ")
run_cli_test "'status': 1" cuopt_sh -s -c $CLIENT_CERT -p $CUOPT_SERVER_PORT $requestid -k
run_cli_test "'status': 1" cuopt_sh -s -c $CLIENT_CERT -p $CUOPT_SERVER_PORT ../../datasets/cuopt_service_data/good_lp.json -wid $requestid
run_cli_test "'status': 'Optimal'" cuopt_sh -s -c $CLIENT_CERT -p $CUOPT_SERVER_PORT $requestid -k
run_cli_test "'status': 'Optimal'" cuopt_sh -s -c $CLIENT_CERT -p $CUOPT_SERVER_PORT ../../datasets/cuopt_service_data/good_lp.json -wid $requestid

# Success, larger problem, result comes back in results dir
run_cli_test "'result_file': 'data.result'" cuopt_sh -s -c "$CLIENT_CERT" -p $CUOPT_SERVER_PORT ../../datasets/cuopt_service_data/service_data_200r.json -o data.result
Expand Down
8 changes: 1 addition & 7 deletions docs/cuopt/source/cuopt-server/client-api/sh-cli-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ LP Supporting Classes
:undoc-members:
:no-inherited-members:

.. autoclass:: solution.solution.PDLPWarmStartData
:members:
:undoc-members:
:no-inherited-members:

.. autoclass:: data_model.DataModel
:members:
:undoc-members:
Expand All @@ -38,11 +33,10 @@ LP Supporting Classes
:members:
:undoc-members:

.. autoclass:: solution.Solution
.. autoclass:: cuopt_sh_client.ThinClientSolution
:members:
:undoc-members:


Self-Hosted Client CLI
----------------------

Expand Down
37 changes: 18 additions & 19 deletions docs/cuopt/source/cuopt-server/examples/lp-examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ Normal mode response:
{
"response": {
"solver_response": {
"status": 1,
"status": "Optimal",
"solution": {
"problem_category": 0,
"problem_category": "LP",
"primal_solution": [
1.8,
0.0
Expand Down Expand Up @@ -159,9 +159,9 @@ Batch mode response:
"response": {
"solver_response": [
{
"status": 1,
"status": "Optimal",
"solution": {
"problem_category": 0,
"problem_category": "LP",
"primal_solution": [
1.8,
0.0
Expand All @@ -188,9 +188,9 @@ Batch mode response:
}
},
{
"status": 1,
"status": "Optimal",
"solution": {
"problem_category": 0,
"problem_category": "LP",
"primal_solution": [
1.8,
0.0
Expand Down Expand Up @@ -294,9 +294,9 @@ The response would be as follows:
{
"response": {
"solver_response": {
"status": 1,
"status": "Optimal",
"solution": {
"problem_category": 0,
"problem_category": "LP",
"primal_solution": [
1.8,
0.0
Expand Down Expand Up @@ -388,9 +388,9 @@ The response is:
{
"response": {
"solver_response": {
"status": 1,
"status": "Optimal",
"solution": {
"problem_category": 0,
"problem_category": "LP",
"primal_solution": [
1.8,
0.0
Expand Down Expand Up @@ -515,23 +515,22 @@ Use a datamodel generated from mps file as input; this yields a solution object
solution_obj = solution["response"]["solver_response"]["solution"]

# Check Termination Reason
# For more detail on termination reasons: checkout `Solution.get_termination_reason()`
print("Termination Reason: (1 is Optimal)")
print("Termination Reason: ")
print(solution_status)

# Check found objective value
print("Objective Value:")
print(solution_obj["primal_objective"])
print(solution_obj.get_primal_objective())

# Check the MPS parse time
print(f"Mps Parse time: {parse_time:.3f} sec")

# Check network time (client call - solve time)
network_time = network_time - (solution_obj["solver_time"])
network_time = network_time - (solution_obj.get_solve_time())
print(f"Network time: {network_time:.3f} sec")

# Check solver time
solve_time = solution_obj["solver_time"]
solve_time = solution_obj.get_solve_time()
print(f"Engine Solve time: {solve_time:.3f} sec")

# Check the total end to end time (mps parsing + network + solve time)
Expand All @@ -540,7 +539,7 @@ Use a datamodel generated from mps file as input; this yields a solution object

# Print the found decision variables
print("Variables Values:")
print(solution_obj["vars"])
print(solution_obj.get_vars())


The response would be as follows:
Expand Down Expand Up @@ -625,9 +624,9 @@ Response is as follows:
{
"response": {
"solver_response": {
"status": 1,
"status": "Optimal",
"solution": {
"problem_category": 0,
"problem_category": "LP",
"primal_solution": [1.8, 0.0],
"dual_solution": [-0.06666666666666668, 0.0],
"primal_objective": -0.36000000000000004,
Expand Down Expand Up @@ -713,4 +712,4 @@ Aborting a Running Job In CLI
Please refer to the `MILP Example <milp-examples.html#aborting-a-running-job-in-cli>`_ for more details.

.. note::
Please use solver settings while using .mps files.
Please use solver settings while using .mps files.
8 changes: 4 additions & 4 deletions docs/cuopt/source/cuopt-server/examples/milp-examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ The response would be as follows:
{
"response": {
"solver_response": {
"status": 1,
"status": "Optimal",
"solution": {
"problem_category": 1,
"problem_category": "MIP",
"primal_solution": [
0.0,
5000.0
Expand Down Expand Up @@ -210,9 +210,9 @@ Incumbent callback response:
{
"response": {
"solver_response": {
"status": 1,
"status": "Optimal",
"solution": {
"problem_category": 1,
"problem_category": "MIP",
"primal_solution": [
0.0,
5000.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Third-Party Modeling Languages
AMPL Support
--------------------------

AMPL can be used with near zero code changes: simply switch to cuOpt as a solver to solve linear and mixed-integer programming problems. Please refer to the `AMPL documentation <https://www.ampl.com/>`_ for more information.
AMPL can be used with near zero code changes: simply switch to cuOpt as a solver to solve linear and mixed-integer programming problems. Please refer to the `AMPL documentation <https://www.ampl.com/>`_ for more information. Also, see the example notebook in the `colab <https://colab.research.google.com/drive/1eEQik_pae4g_tJQ61QJFlO1fFBXazpBr?usp=sharing>`_.

--------------------------
PuLP Support
Expand Down
2 changes: 1 addition & 1 deletion python/cuopt/cuopt/linear_programming/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ cmake.version = "CMakeLists.txt"
minimum-version = "build-system.requires"
ninja.make-fallback = false
sdist.reproducible = true
wheel.packages=["data_model", "solution", "cuopt_mps_parser"]
wheel.packages=["data_model", "cuopt_mps_parser"]

[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.regex"
Expand Down
1 change: 1 addition & 0 deletions python/cuopt_self_hosted/cuopt_sh_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
mime_type,
set_log_level,
)
from .thin_client_solution import ThinClientSolution
from .thin_client_solver_settings import (
PDLPSolverMode,
SolverMethod,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import msgpack_numpy
import numpy as np
import requests
import solution

from . import _version
from .thin_client_solution import ThinClientSolution
from .thin_client_solver_settings import ThinClientSolverSettings

msgpack_numpy.patch()
Expand Down Expand Up @@ -173,8 +173,8 @@ def create_solution_obj(solver_response):
problem_category = sol["problem_category"]

# MILP
if problem_category in [1, 2]:
solution_obj = solution.Solution(
if problem_category in ["MIP", "IP"]:
solution_obj = ThinClientSolution(
problem_category,
sol["vars"],
solve_time=sol["solver_time"],
Expand All @@ -198,7 +198,7 @@ def create_solution_obj(solver_response):
],
)
else:
solution_obj = solution.Solution(
solution_obj = ThinClientSolution(
problem_category,
sol["vars"],
solve_time=sol["solver_time"],
Expand Down Expand Up @@ -716,7 +716,7 @@ def get_LP_solve(
See the LP documentation for details on solver settings.
response_type : str
Choose "dict" if response should be returned as a dictionary or
"obj" for Solution object. Defaults to "obj"
"obj" for ThinClientSolution object. Defaults to "obj"
filepath : boolean
Indicates that cuopt_problem_json_data
is the relative path of a cuopt data file under the server's
Expand Down Expand Up @@ -750,7 +750,7 @@ def get_LP_solve(
a list of strings. The LP solver will not return any
incumbent solutions. Default is None.

Returns: dict or Solution object.
Returns: dict or ThinClientSolution object.
"""

if incumbent_callback is not None and not callable(incumbent_callback):
Expand Down Expand Up @@ -923,7 +923,7 @@ def repoll(self, data, response_type="obj", delete_solution=True):
containing the key 'reqId' where the value is the uuid.
response_type: str
For LP problem choose "dict" if response should be returned
as a dictionary or "obj" for Solution object.
as a dictionary or "obj" for ThinClientSolution object.
Defaults to "obj".
For VRP problem, response_type is ignored and always
returns a dict.
Expand Down
Loading