Skip to content

Commit 95121cd

Browse files
committed
Merge remote-tracking branch 'cuopt-nvidia/main' into mir_cuts_improve
2 parents 7f3bd36 + 51addf5 commit 95121cd

12 files changed

Lines changed: 96 additions & 34 deletions

File tree

.github/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- ignore-for-release
5+
- dependencies
6+
authors:
7+
- rapids-bot[bot]
8+
- dependabot[bot]
9+
categories:
10+
- title: "\U0001F6A8 Breaking Changes"
11+
labels:
12+
- breaking
13+
- title: "\U0001F41B Bug Fixes"
14+
labels:
15+
- bug
16+
- title: "\U0001F4D6 Documentation"
17+
labels:
18+
- doc
19+
- title: "\U0001F680 New Features"
20+
labels:
21+
- feature request
22+
- title: "\U0001F6E0\uFE0F Improvements"
23+
labels:
24+
- improvement

cpp/src/mip_heuristics/diversity/diversity_manager.cu

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,20 @@ bool diversity_manager_t<i_t, f_t>::run_presolve(f_t time_limit)
201201
compute_probing_cache(ls.constraint_prop.bounds_update, *problem_ptr, probing_timer);
202202
if (problem_is_infeasible) { return false; }
203203
}
204-
const bool remap_cache_ids = true;
205-
trivial_presolve(*problem_ptr, remap_cache_ids);
206-
if (!problem_ptr->empty && !check_bounds_sanity(*problem_ptr)) { return false; }
207-
// May overconstrain if Papilo presolve has been run before
208-
if (context.settings.presolver == presolver_t::None) {
209-
if (!problem_ptr->empty) {
210-
// do the resizing no-matter what, bounds presolve might not change the bounds but initial
211-
// trivial presolve might have
212-
ls.constraint_prop.bounds_update.resize(*problem_ptr);
213-
ls.constraint_prop.conditional_bounds_update.update_constraint_bounds(
214-
*problem_ptr, ls.constraint_prop.bounds_update);
215-
if (!check_bounds_sanity(*problem_ptr)) { return false; }
204+
if (!presolve_timer.check_time_limit()) {
205+
const bool remap_cache_ids = true;
206+
trivial_presolve(*problem_ptr, remap_cache_ids);
207+
if (!problem_ptr->empty && !check_bounds_sanity(*problem_ptr)) { return false; }
208+
// May overconstrain if Papilo presolve has been run before
209+
if (context.settings.presolver == presolver_t::None) {
210+
if (!problem_ptr->empty) {
211+
// do the resizing no-matter what, bounds presolve might not change the bounds but initial
212+
// trivial presolve might have
213+
ls.constraint_prop.bounds_update.resize(*problem_ptr);
214+
ls.constraint_prop.conditional_bounds_update.update_constraint_bounds(
215+
*problem_ptr, ls.constraint_prop.bounds_update);
216+
if (!check_bounds_sanity(*problem_ptr)) { return false; }
217+
}
216218
}
217219
}
218220
stats.presolve_time = presolve_timer.elapsed_time();

cpp/src/mip_heuristics/solve.cu

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ mip_solution_t<i_t, f_t> run_mip(detail::problem_t<i_t, f_t>& problem,
153153
detail::trivial_presolve(scaled_problem);
154154

155155
detail::mip_solver_t<i_t, f_t> solver(scaled_problem, settings, scaling, timer);
156+
if (timer.check_time_limit()) {
157+
CUOPT_LOG_INFO("Time limit reached before main solve");
158+
detail::solution_t<i_t, f_t> sol(problem);
159+
auto stats = solver.get_solver_stats();
160+
stats.total_solve_time = timer.elapsed_time();
161+
return sol.get_solution(false, stats, false);
162+
}
156163
auto scaled_sol = solver.run_solver();
157164
bool is_feasible_before_scaling = scaled_sol.get_feasible();
158165
scaled_sol.problem_ptr = &problem;

cpp/src/mip_heuristics/solver.cu

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ solution_t<i_t, f_t> mip_solver_t<i_t, f_t>::run_solver()
134134
return sol;
135135
}
136136

137+
if (timer_.check_time_limit()) {
138+
CUOPT_LOG_INFO("Time limit reached after presolve");
139+
solution_t<i_t, f_t> sol(*context.problem_ptr);
140+
context.stats.total_solve_time = timer_.elapsed_time();
141+
context.problem_ptr->post_process_solution(sol);
142+
return sol;
143+
}
144+
137145
// if the problem was reduced to a LP: run concurrent LP
138146
if (run_presolve && context.problem_ptr->n_integer_vars == 0) {
139147
CUOPT_LOG_INFO("Problem reduced to a LP, running concurrent LP");
@@ -285,6 +293,14 @@ solution_t<i_t, f_t> mip_solver_t<i_t, f_t>::run_solver()
285293
std::placeholders::_5,
286294
std::placeholders::_6);
287295

296+
if (timer_.check_time_limit()) {
297+
CUOPT_LOG_INFO("Time limit reached during B&B setup");
298+
solution_t<i_t, f_t> sol(*context.problem_ptr);
299+
context.stats.total_solve_time = timer_.elapsed_time();
300+
context.problem_ptr->post_process_solution(sol);
301+
return sol;
302+
}
303+
288304
// Fork a thread for branch and bound
289305
// std::async and std::future allow us to get the return value of bb::solve()
290306
// without having to manually manage the thread

cpp/src/pdlp/swap_and_resize_helper.cuh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <thrust/iterator/permutation_iterator.h>
1717
#include <thrust/iterator/transform_iterator.h>
1818
#include <thrust/iterator/zip_iterator.h>
19+
#include <thrust/tuple.h>
1920
#include <thrust/universal_vector.h>
2021

2122
#include <cuda/std/tuple>

cpp/src/pdlp/utils.cuh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <thrust/execution_policy.h>
2626
#include <thrust/functional.h>
2727
#include <thrust/transform_reduce.h>
28+
#include <thrust/tuple.h>
2829

2930
namespace cuopt::linear_programming::detail {
3031

cpp/src/routing/utilities/check_input.cu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* clang-format off */
22
/*
3-
* SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
* SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
/* clang-format on */
@@ -17,6 +17,7 @@
1717
#include <thrust/iterator/counting_iterator.h>
1818
#include <thrust/logical.h>
1919
#include <thrust/pair.h>
20+
#include <thrust/tuple.h>
2021
#include <cuda/std/functional>
2122

2223
#include <unordered_set>

cpp/src/utilities/copy_helpers.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <rmm/exec_policy.hpp>
1616

1717
#include <thrust/transform.h>
18+
#include <thrust/tuple.h>
1819
#include <thrust/universal_vector.h>
1920

2021
#include <cuda/std/functional>

cpp/src/utilities/cuda_helpers.cuh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <utilities/macros.cuh>
1111

1212
#include <thrust/host_vector.h>
13+
#include <thrust/tuple.h>
1314
#include <mutex>
1415
#include <raft/core/device_span.hpp>
1516
#include <raft/util/cuda_utils.cuh>

python/cuopt_server/cuopt_server/tests/test_bill_logging.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

44
import json
5+
import os
56
import platform
67
import shutil
78
import signal
@@ -29,16 +30,12 @@ def test_time_limit_logs():
2930
)
3031
dataset = json.load(open(dataset_path))
3132
client = RequestClient(port=5010)
32-
env = {
33-
"CUOPT_SERVER_IP": "127.0.0.1",
34-
"CUOPT_SERVER_PORT": "5010",
35-
"CUOPT_SERVER_LOG_LEVEL": "debug",
36-
"CUOPT_MAX_SOLVE_TIME_LIMIT": "5",
37-
}
33+
env = os.environ.copy()
34+
env["CUOPT_MAX_SOLVE_TIME_LIMIT"] = "5"
3835

3936
url = "/cuopt/"
4037

41-
cmd = python_path + " " + server_script
38+
cmd = python_path + " " + server_script + " -i 127.0.0.1 -p 5010 -l debug"
4239
process = pexpect.spawn(cmd, env=env)
4340

4441
try:

0 commit comments

Comments
 (0)