Skip to content
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
74feefb
Added a setting to control the diving parameters
nguidotti Aug 15, 2025
326eec6
Changed branch and bound to use diving.
nguidotti Aug 15, 2025
e6db94e
Expanded options for the search strategy
nguidotti Aug 18, 2025
71955f4
Integrated diving with best-first search.
nguidotti Aug 19, 2025
b68295c
Fixed invalid future in plain best-first.
nguidotti Aug 19, 2025
5152458
Clean the code and removed depth-first search
nguidotti Aug 20, 2025
73659d2
Shared pseudocost between main and diving threads
nguidotti Aug 21, 2025
7064489
Undo sharing pseudocost (due to regression)
nguidotti Aug 21, 2025
180ec69
Extracted repair solution from bnb.
nguidotti Aug 22, 2025
0df95ba
Aggregated most local variables into a struct.
nguidotti Aug 22, 2025
303eea2
Moved best first search to a separated method
nguidotti Aug 22, 2025
0e3ef50
Moved branch logic to a separated method
nguidotti Aug 22, 2025
7b0ce1f
Extracted adding feasible solution and solving leaf LP.
nguidotti Aug 22, 2025
9fbb030
Added depth first search using the refactored code
nguidotti Aug 22, 2025
4fd9cf5
Fixed hanging due to incorrect calculation of the lower bounds for an…
nguidotti Aug 22, 2025
9d5e911
Merging 25.10 branch
nguidotti Aug 25, 2025
876d897
Fixed bugs caused by merge
nguidotti Aug 25, 2025
cf4426f
merged stats structs
nguidotti Aug 25, 2025
df67a2b
set common variables as class attributes.
nguidotti Aug 25, 2025
187e191
Moved search settings to simplex settings
nguidotti Aug 26, 2025
f4c150b
Refactor based on reviewer's feedback
nguidotti Aug 26, 2025
a8aacc5
Support cuda 12.9 (#269)
rgsl888prabhu Aug 25, 2025
a5e1682
Performance tweak for dual_simplex/right_looking_lu (#315)
ahehn-nv Aug 26, 2025
2f8dcd9
Reduce hard-coded version usage in repo (#337)
rgsl888prabhu Aug 27, 2025
defb947
Moved all shared variables to be member variables.
nguidotti Aug 27, 2025
af177e9
Added tests
nguidotti Aug 28, 2025
78067e4
Merge branch 'branch-25.10' into diving
nguidotti Aug 28, 2025
30c0333
changed code based on reviewer's feedback
nguidotti Aug 29, 2025
ae33427
more changes based on feedback
nguidotti Aug 29, 2025
0017b50
moved pseudocost to be a global variable
nguidotti Aug 29, 2025
f2f029a
fix incorrect set status
nguidotti Aug 29, 2025
2f51ac0
fixing failing tests
nguidotti Aug 29, 2025
76d75e0
Merge branch 'branch-25.10' into diving
nguidotti Sep 1, 2025
a45672a
fix incorrect solution callback
nguidotti Sep 1, 2025
ec18bd3
fix incorrect callback
nguidotti Sep 1, 2025
73fac2c
set dfs in submip
nguidotti Sep 1, 2025
ecc68bd
Merge branch 'branch-25.10' into diving
nguidotti Sep 5, 2025
ea8e20e
small fixes based on the feedback.
nguidotti Sep 10, 2025
1d2f0a0
removed external search_strategy. removed logs from depth-first
nguidotti Sep 15, 2025
2b4ecc5
Merge commit '4e8bdaec42202feceb1d8d0ed148c5187530eb63' into diving
nguidotti Sep 15, 2025
d88bd3f
Merge branch 'branch-25.10' into diving
nguidotti Sep 15, 2025
56a061d
small fix
nguidotti Sep 15, 2025
e715e21
Merge branch 'branch-25.10' into diving
nguidotti Sep 16, 2025
7b713d8
readded validation tests for different search strategies
nguidotti Sep 16, 2025
db73ba4
Merge branch 'branch-25.10' into diving
nguidotti Sep 16, 2025
3026dbe
Update solve.cpp
nguidotti Sep 16, 2025
895c372
Update solve.hpp
nguidotti Sep 16, 2025
5424979
Update simplex_solver_settings.hpp
nguidotti Sep 16, 2025
f9fb5ad
Update solve.cpp
nguidotti Sep 16, 2025
041e104
removed validation tests as it was missing important steps
nguidotti Sep 16, 2025
d7fe015
Merge branch 'branch-25.10' into diving
nguidotti Sep 17, 2025
dd7e340
Merge branch 'branch-25.10' into diving
nguidotti Sep 17, 2025
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
55 changes: 45 additions & 10 deletions benchmarks/linear_programming/cuopt/run_mip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "initial_solution_reader.hpp"
#include "mip_test_instances.hpp"

#include <cstdio>
#include <cuopt/linear_programming/mip/solver_settings.hpp>
#include <cuopt/linear_programming/mip/solver_solution.hpp>
#include <cuopt/linear_programming/optimization_problem.hpp>
Expand Down Expand Up @@ -151,7 +152,8 @@ int run_single_file(std::string file_path,
int num_cpu_threads,
bool write_log_file,
bool log_to_console,
double time_limit)
double time_limit,
cuopt::linear_programming::bnb_search_strategy_t search_strategy)
{
const raft::handle_t handle_{};
cuopt::linear_programming::mip_solver_settings_t<int, double> settings;
Expand All @@ -168,11 +170,13 @@ int run_single_file(std::string file_path,
}
}

settings.bnb_search_strategy = search_strategy;

constexpr bool input_mps_strict = false;
cuopt::mps_parser::mps_data_model_t<int, double> mps_data_model;
bool parsing_failed = false;
{
CUOPT_LOG_INFO("running file %s on gpu : %d", base_filename.c_str(), device);
CUOPT_LOG_INFO("Running file %s", base_filename.c_str());
try {
mps_data_model = cuopt::mps_parser::parse_mps<int, double>(file_path, input_mps_strict);
} catch (const std::logic_error& e) {
Expand Down Expand Up @@ -252,7 +256,8 @@ void run_single_file_mp(std::string file_path,
int num_cpu_threads,
bool write_log_file,
bool log_to_console,
double time_limit)
double time_limit,
cuopt::linear_programming::bnb_search_strategy_t search_strategy)
{
std::cout << "running file " << file_path << " on gpu : " << device << std::endl;
auto memory_resource = make_async();
Expand All @@ -266,7 +271,8 @@ void run_single_file_mp(std::string file_path,
num_cpu_threads,
write_log_file,
log_to_console,
time_limit);
time_limit,
search_strategy);
// this is a bad design to communicate the result but better than adding complexity of IPC or
// pipes
exit(sol_found);
Expand Down Expand Up @@ -340,6 +346,15 @@ int main(int argc, char* argv[])
.scan<'g', double>()
.default_value(std::numeric_limits<double>::max());

program.add_argument("--search-strategy")
.help("Search strategy used in B&B (bfs/bfs-diving/dfs)")
.default_value(std::string("bfs"));

program.add_argument("--gpu")
.help("id of the GPU to use when running a single test (default: 0)")
.scan<'i', int>()
.default_value(0);

// Parse arguments
try {
program.parse_args(argc, argv);
Expand All @@ -362,10 +377,25 @@ int main(int argc, char* argv[])
std::string result_file;
int batch_num = -1;

bool heuristics_only = program.get<std::string>("--heuristics-only")[0] == 't';
int num_cpu_threads = program.get<int>("--num-cpu-threads");
bool write_log_file = program.get<std::string>("--write-log-file")[0] == 't';
bool log_to_console = program.get<std::string>("--log-to-console")[0] == 't';
bool heuristics_only = program.get<std::string>("--heuristics-only")[0] == 't';
int num_cpu_threads = program.get<int>("--num-cpu-threads");
bool write_log_file = program.get<std::string>("--write-log-file")[0] == 't';
bool log_to_console = program.get<std::string>("--log-to-console")[0] == 't';
std::string search_strategy_cli = program.get<std::string>("--search-strategy");
int gpu_id = program.get<int>("--gpu");

cuopt::linear_programming::bnb_search_strategy_t search_strategy;
if (search_strategy_cli == "bfs") {
search_strategy = cuopt::linear_programming::bnb_search_strategy_t::BEST_FIRST;
} else if (search_strategy_cli == "bfs-diving") {
search_strategy =
cuopt::linear_programming::bnb_search_strategy_t::MULTITHREADED_BEST_FIRST_WITH_DIVING;
} else if (search_strategy_cli == "dfs") {
search_strategy = cuopt::linear_programming::bnb_search_strategy_t::DEPTH_FIRST;
} else {
std::cerr << "Invalid search strategy: " << search_strategy_cli << std::endl;
exit(1);
}

if (program.is_used("--out-dir")) {
out_dir = program.get<std::string>("--out-dir");
Expand Down Expand Up @@ -450,7 +480,8 @@ int main(int argc, char* argv[])
num_cpu_threads,
write_log_file,
log_to_console,
time_limit);
time_limit,
search_strategy);
} else if (sys_pid < 0) {
std::cerr << "Fork failed!" << std::endl;
exit(1);
Expand All @@ -468,6 +499,9 @@ int main(int argc, char* argv[])
}
merge_result_files(out_dir, result_file, n_gpus, batch_num);
} else {
RAFT_CUDA_TRY(cudaSetDevice(gpu_id));
CUOPT_LOG_INFO("Using GPU %d", gpu_id);

auto memory_resource = make_async();
rmm::mr::set_current_device_resource(memory_resource.get());
run_single_file(path,
Expand All @@ -479,7 +513,8 @@ int main(int argc, char* argv[])
num_cpu_threads,
write_log_file,
log_to_console,
time_limit);
time_limit,
search_strategy);
}

return 0;
Expand Down
8 changes: 8 additions & 0 deletions cpp/include/cuopt/linear_programming/mip/solver_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ struct benchmark_info_t {
double objective_of_initial_population = std::numeric_limits<double>::max();
};

enum class bnb_search_strategy_t {
BEST_FIRST = 0,
DEPTH_FIRST = 1,
MULTITHREADED_BEST_FIRST_WITH_DIVING = 2,
};

// Forward declare solver_settings_t for friend class
template <typename i_t, typename f_t>
class solver_settings_t;
Expand Down Expand Up @@ -79,6 +85,8 @@ class mip_solver_settings_t {
f_t relative_mip_gap = 1.0e-4;
};

bnb_search_strategy_t bnb_search_strategy = bnb_search_strategy_t::BEST_FIRST;

/**
* @brief Get the tolerance settings as a single structure.
*/
Expand Down
Loading