Skip to content

Commit eace2b8

Browse files
committed
Fix merge conflicts
2 parents b0a8c5d + 8dc24a7 commit eace2b8

File tree

15 files changed

+621
-195
lines changed

15 files changed

+621
-195
lines changed

ci/test_self_hosted_service.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ if [ "$doservertest" -eq 1 ]; then
217217
# Test for message on absolute path, bad directory
218218
run_cli_test "Absolute path '/nohay' does not exist" cuopt_sh -s -c "$CLIENT_CERT" -p $CUOPT_SERVER_PORT -f /nohay/nada
219219

220+
# Set all current and deprecated solver_config values and make sure the service does not reject the dataset
221+
# This is a smoketest against parameter name misalignment
222+
run_cli_test "'status': 'Optimal'" cuopt_sh -s -c $CLIENT_CERT -p $CUOPT_SERVER_PORT ../../datasets/cuopt_service_data/lpmip_configs.json
223+
220224
rapids-logger "Running cuopt_self_hosted Python tests"
221225
pytest tests
222226

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"csr_constraint_matrix": {
3+
"offsets": [
4+
0,
5+
2,
6+
4
7+
],
8+
"indices": [
9+
0,
10+
1,
11+
0,
12+
1
13+
],
14+
"values": [
15+
3.0,
16+
4.0,
17+
2.7,
18+
10.1
19+
]
20+
},
21+
"constraint_bounds": {
22+
"bounds": [
23+
5.4,
24+
4.9
25+
],
26+
"upper_bounds": [
27+
5.4,
28+
4.9
29+
],
30+
"lower_bounds": [
31+
"ninf",
32+
"ninf"
33+
]
34+
},
35+
"objective_data": {
36+
"coefficients": [
37+
0.2,
38+
0.1
39+
],
40+
"scalability_factor": 1.0,
41+
"offset": 0.0
42+
},
43+
"variable_bounds": {
44+
"upper_bounds": [
45+
"inf",
46+
"inf"
47+
],
48+
"lower_bounds": [
49+
0.0,
50+
0.0
51+
]
52+
},
53+
"maximize": false,
54+
"solver_config": {
55+
"tolerances": {
56+
"optimality": 0.0001,
57+
"absolute_primal_tolerance": 0.0001,
58+
"absolute_dual_tolerance": 0.0001,
59+
"absolute_gap_tolerance": 0.0001,
60+
"relative_primal_tolerance": 0.0001,
61+
"relative_dual_tolerance": 0.0001,
62+
"relative_gap_tolerance": 0.0001,
63+
"primal_infeasible_tolerance": 0.0001,
64+
"dual_infeasible_tolerance": 0.0001,
65+
"mip_integrality_tolerance": 0.0001,
66+
"mip_absolute_gap": 0.0001,
67+
"mip_relative_gap": 0.0001,
68+
"mip_absolute_tolerance": 0.0001,
69+
"mip_relative_tolerance": 0.0001,
70+
71+
"absolute_primal": 0.0001,
72+
"absolute_dual": 0.0001,
73+
"absolute_gap": 0.0001,
74+
"relative_primal": 0.0001,
75+
"relative_dual": 0.0001,
76+
"relative_gap": 0.0001,
77+
"primal_infeasible": 0.0001,
78+
"dual_infeasible": 0.0001,
79+
"integrality_tolerance": 0.0001,
80+
"absolute_mip_gap": 0.0001,
81+
"relative_mip_gap": 0.0001
82+
},
83+
"infeasibility_detection": true,
84+
"time_limit": 5,
85+
"iteration_limit": 100,
86+
"pdlp_solver_mode": 2,
87+
"method": 2,
88+
"mip_scaling": true,
89+
"mip_heuristics_only": true,
90+
"num_cpu_threads": 100,
91+
"crossover": true,
92+
"log_to_console": false,
93+
"strict_infeasibility": false,
94+
"user_problem_file": "bob",
95+
"per_constraint_residual": true,
96+
"save_best_primal_so_far": true,
97+
"first_primal_feasible": true,
98+
"log_file": "bill",
99+
"solution_file": "barry",
100+
"solver_mode": 3,
101+
"heuristics_only": false
102+
}
103+
}

docs/cuopt/source/lp-features.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,17 @@ Crossover
7676
Crossover allows you to obtain a high-quality basic solution from the results of a PDLP solve. More details can be found :ref:`here <crossover>`.
7777

7878

79-
Logging Callback
80-
----------------
81-
With logging callback, users can fetch server-side logs for additional debugs and to get details on solver process details. :ref:`Examples <generic-example-with-normal-and-batch-mode>` are shared on the self-hosted page.
79+
Logging
80+
-------
81+
82+
The CUOPT_LOG_FILE parameter can be set to write detailed solver logs for LP problems. This parameter is available in all APIs that allow setting solver parameters except the cuOpt service. For the service, see the logging callback below.
83+
84+
Logging Callback in the Service
85+
-------------------------------
86+
87+
In the cuOpt service API, the ``log_file`` value in ``solver_configs`` is ignored.
88+
89+
If however you set the ``solver_logs`` flag on the ``/cuopt/request`` REST API call, users can fetch the log file content from the webserver at ``/cuopt/logs/{id}``. Using the logging callback feature through the cuOpt client is shown in :ref:`Examples <generic-example-with-normal-and-batch-mode>` on the self-hosted page.
8290

8391

8492
Infeasibility Detection

docs/cuopt/source/lp-milp-settings.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ Log File
3939
^^^^^^^^
4040
``CUOPT_LOG_FILE`` controls the name of a log file where cuOpt should write information about the solve.
4141

42-
Note: the default value is ``""`` and no log file is written.
42+
Note: the default value is ``""`` and no log file is written. This setting is ignored by the cuOpt service, use the log callback feature instead.
4343

4444
Solution File
4545
^^^^^^^^^^^^^
46-
``CUOPT_SOL_FILE`` controls the name of a file where cuOpt should write the solution.
46+
``CUOPT_SOLUTION_FILE`` controls the name of a file where cuOpt should write the solution.
4747

48-
Note: the default value is ``""`` and no solution file is written.
48+
Note: the default value is ``""`` and no solution file is written. This setting is ignored by the cuOpt service.
4949

5050
User Problem File
5151
^^^^^^^^^^^^^^^^^
5252
``CUOPT_USER_PROBLEM_FILE`` controls the name of a file where cuOpt should write the user problem.
5353

54-
Note: the default value is ``""`` and no user problem file is written.
54+
Note: the default value is ``""`` and no user problem file is written. This setting is ignored by the cuOpt service.
5555

5656
Num CPU Threads
5757
^^^^^^^^^^^^^^^
@@ -260,7 +260,7 @@ We now describe parameter settings for the MILP solvers
260260
Heuristics only
261261
^^^^^^^^^^^^^^^
262262

263-
``CUOPT_HEURISTICS_ONLY`` controls if only the GPU heuristics should be run. When set to true, only the primal
263+
``CUOPT_MIP_HEURISTICS_ONLY`` controls if only the GPU heuristics should be run for the MIP problem. When set to true, only the primal
264264
bound is improved via the GPU. When set to false, both the GPU and CPU are used and
265265
the dual bound is improved on the CPU.
266266

@@ -278,14 +278,14 @@ Note: the defaulte value is true.
278278
Absolute Tolerance
279279
^^^^^^^^^^^^^^^^^^
280280

281-
``CUOPT_ABSOLUTE_TOLERANCE`` controls the MIP absolute tolerance.
281+
``CUOPT_MIP_ABSOLUTE_TOLERANCE`` controls the MIP absolute tolerance.
282282

283283
Note: the default value is ``1e-4``.
284284

285285
Relative Tolerance
286286
^^^^^^^^^^^^^^^^^^
287287

288-
``CUOPT_RELATIVE_TOLERANCE`` controls the MIP relative tolerance.
288+
``CUOPT_MIP_RELATIVE_TOLERANCE`` controls the MIP relative tolerance.
289289

290290
Note: the default value is ``1e-6``.
291291

docs/cuopt/source/milp-features.rst

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,23 @@ There are two ways to specify constraints in cuOpt MILP:
5050

5151
Both forms are mathematically equivalent. The choice between them is a matter of convenience depending on your problem formulation.
5252

53-
Incumbent Solution Callback
54-
---------------------------
53+
Incumbent Solution Callback in the Service
54+
------------------------------------------
5555

56-
User can provide a callback to receive new integer feasible solutions that improve the objective (called incumbents) while the solver is running. An :ref:`Incumbent Example <incumbent-and-logging-callback>` is shared on the self-hosted page.
56+
When using the service, users can provide a callback to receive new integer feasible solutions that improve the objective (called incumbents) while the solver is running. An :ref:`Incumbent Example <incumbent-and-logging-callback>` is shared on the self-hosted page.
5757

58-
Logging Callback
59-
----------------
58+
Logging
59+
-------
60+
61+
The CUOPT_LOG_FILE parameter can be set to write detailed solver logs for MILP problems. This parameter is available in all APIs that allow setting solver parameters except for the cuOpt service. For the service, see the logging callback below.
62+
63+
Logging Callback in the Service
64+
-------------------------------
65+
66+
In the cuOpt service API, the ``log_file`` value in ``solver_configs`` is ignored.
67+
68+
If however you set the ``solver_logs`` flag on the ``/cuopt/request`` REST API call, users can fetch the log file content from the webserver at ``/cuopt/logs/{id}``. Using the logging callback feature through the cuOpt client is shown in :ref:`Logging Callback Example <incumbent-and-logging-callback>` on the self-hosted page.
6069

61-
A logging callback allows users to get additional information about how the solve is progressing. A :ref:`Logging Callback Example <incumbent-and-logging-callback>` is shared on the self-hosted page.
6270

6371
Time Limit
6472
--------------

docs/cuopt/source/transition.rst

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
========================================
1+
=======================================
22
Transition Guide for Change in Features
3-
========================================
3+
=======================================
44

55
In addition to the quality improvements, some new features were added, and some features were deprecated to improve user experience. For any questions, please reach out to the cuOpt team through github issues.
66

@@ -10,8 +10,72 @@ Parameter/option statuses are listed below, they express how each of these optio
1010

1111
**Update** - A change in definition of feature.
1212

13-
**Deprecated** - These are “no operation” options, they will be accepted by the server, but they will not be used anywhere. And the solver will also return a warning about them being deprecated.
13+
**Deprecated** - These options will be accepted but will be removed in the future. In the case of the cuOpt service, the server will also return a warning noting that a feature is deprecated.
1414

1515
**Limited** - These options are limited with respect to the number of dimensions that can be provided.
1616

17-
**Removed** - These features were deprecated in previous release and completely removed in this one.
17+
**Removed** - These features were deprecated in a previous release and completely removed in this one.
18+
19+
For all solver_configs fields, see the LP/MILP settings guide :doc:`lp-milp-settings` or the service openapi spec :doc:`open-api`.
20+
21+
Changes to solver_configs.tolerances
22+
------------------------------------
23+
24+
The following fields are **Deprecated** in ``solver_configs.tolerances`` for the service:
25+
26+
- absolute_primal
27+
- absolute_dual
28+
- absolute_gap
29+
- relative_primal
30+
- relative_dual
31+
- relative_gap
32+
- primal_infeasible
33+
- dual_infeasible
34+
- integrality_tolerance
35+
- absolute_mip_gap
36+
- relative_mip_gap
37+
38+
The following fields are **New** in ``solver_configs.tolerances`` for the service and replace the deprecated fields above:
39+
40+
- absolute_primal_tolerance
41+
- absolute_dual_tolerance
42+
- absolute_gap_tolerance
43+
- relative_primal_tolerance
44+
- relative_dual_tolerance
45+
- relative_gap_tolerance
46+
- primal_infeasible_tolerance
47+
- dual_infeasible_tolerance
48+
- mip_integrality_tolerance
49+
- mip_absolute_gap
50+
- mip_relative_gap
51+
52+
The following fields are **New** in ``solver_configs.tolerances`` for the service but were available in the C API in 25.05
53+
54+
- mip_absolute_tolerance
55+
- mip_relative_tolerance
56+
57+
Changes to solver_configs
58+
-------------------------
59+
60+
The following fields are **Deprecated** in ``solver_configs`` for the service:
61+
62+
- solver_mode
63+
- heuristics_only
64+
65+
The following fields are **New** in ``solver_configs`` for the service and replace the deprecated fields above:
66+
67+
- pdlp_solver_mode
68+
- mip_heuristics_only
69+
70+
The following are **New** in ``solver_configs`` for the service but were available in the C API in 25.05
71+
72+
- strict_infeasibility
73+
- user_problem_file
74+
- per_constraint_residual
75+
- save_best_primal_so_far
76+
- first_primal_feasible
77+
- log_file
78+
- solution_file
79+
80+
81+

python/cuopt/cuopt/linear_programming/solver/solver.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
@catch_cuopt_exception
22-
def Solve(data_model, solver_settings=None, log_file=""):
22+
def Solve(data_model, solver_settings=None):
2323
"""
2424
Solve the Linear Program passed as input and returns the solution.
2525
@@ -92,13 +92,12 @@ def is_mip(var_types):
9292
return solver_wrapper.Solve(
9393
data_model,
9494
solver_settings,
95-
log_file,
9695
mip=is_mip(data_model.get_variable_types()),
9796
)
9897

9998

10099
@catch_cuopt_exception
101-
def BatchSolve(data_model_list, solver_settings=None, log_file=""):
100+
def BatchSolve(data_model_list, solver_settings=None):
102101
"""
103102
Solve the list of Linear Programs passed as input and returns the solutions
104103
and total solve time.
@@ -174,6 +173,4 @@ def BatchSolve(data_model_list, solver_settings=None, log_file=""):
174173
if solver_settings is None:
175174
solver_settings = SolverSettings()
176175

177-
return solver_wrapper.BatchSolve(
178-
data_model_list, solver_settings, log_file
179-
)
176+
return solver_wrapper.BatchSolve(data_model_list, solver_settings)

python/cuopt/cuopt/linear_programming/solver/solver_wrapper.pyx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ from numba import cuda
6565
import cudf
6666
from cudf.core.buffer import as_buffer
6767

68-
from cuopt.linear_programming.solver.solver_parameters import CUOPT_LOG_FILE
6968
from cuopt.linear_programming.solver_settings.solver_settings import (
7069
PDLPSolverMode,
7170
SolverSettings,
@@ -279,7 +278,6 @@ cdef set_data_model_view(DataModel data_model_obj):
279278
cdef set_solver_setting(
280279
unique_ptr[solver_settings_t[int, double]]& unique_solver_settings,
281280
settings,
282-
log_file,
283281
DataModel data_model_obj=None,
284282
mip=False):
285283
cdef solver_settings_t[int, double]* c_solver_settings = (
@@ -425,13 +423,6 @@ cdef set_solver_setting(
425423
settings.get_pdlp_warm_start_data().iterations_since_last_restart # noqa
426424
)
427425

428-
# Common to LP and MIP
429-
430-
c_solver_settings.set_parameter_from_string(
431-
CUOPT_LOG_FILE.encode('utf-8'),
432-
log_file.encode('utf-8')
433-
)
434-
435426
cdef create_solution(unique_ptr[solver_ret_t] sol_ret_ptr,
436427
DataModel data_model_obj,
437428
is_batch=False):
@@ -670,7 +661,7 @@ cdef create_solution(unique_ptr[solver_ret_t] sol_ret_ptr,
670661
)
671662

672663

673-
def Solve(py_data_model_obj, settings, str log_file, mip=False):
664+
def Solve(py_data_model_obj, settings, mip=False):
674665

675666
cdef DataModel data_model_obj = <DataModel>py_data_model_obj
676667
cdef unique_ptr[solver_settings_t[int, double]] unique_solver_settings
@@ -682,7 +673,7 @@ def Solve(py_data_model_obj, settings, str log_file, mip=False):
682673
)
683674

684675
set_solver_setting(
685-
unique_solver_settings, settings, log_file, data_model_obj, mip
676+
unique_solver_settings, settings, data_model_obj, mip
686677
)
687678
set_data_model_view(data_model_obj)
688679

@@ -697,13 +688,13 @@ cdef insert_vector(DataModel data_model_obj,
697688
data_model_views.push_back(data_model_obj.c_data_model_view.get())
698689

699690

700-
def BatchSolve(py_data_model_list, settings, str log_file):
691+
def BatchSolve(py_data_model_list, settings):
701692
cdef unique_ptr[solver_settings_t[int, double]] unique_solver_settings
702693
unique_solver_settings.reset(new solver_settings_t[int, double]())
703694

704695
if settings.get_pdlp_warm_start_data() is not None: # noqa
705696
raise Exception("Cannot use warmstart data with Batch Solve")
706-
set_solver_setting(unique_solver_settings, settings, log_file)
697+
set_solver_setting(unique_solver_settings, settings)
707698

708699
cdef vector[data_model_view_t[int, double] *] data_model_views
709700

0 commit comments

Comments
 (0)