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
21 changes: 14 additions & 7 deletions cpp/src/mip_heuristics/diversity/diversity_manager.cu
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ void diversity_manager_t<i_t, f_t>::add_user_given_solutions(
}

if (problem_ptr->pre_process_assignment(init_sol_assignment)) {
raft::copy(sol.assignment.data(),
init_sol_assignment.data(),
init_sol_assignment.size(),
sol.handle_ptr->get_stream());
relaxed_lp_settings_t lp_settings;
lp_settings.time_limit = std::min(60., timer.remaining_time() / 2);
lp_settings.tolerance = problem_ptr->tolerances.absolute_tolerance;
Expand All @@ -250,11 +254,15 @@ void diversity_manager_t<i_t, f_t>::add_user_given_solutions(
problem_ptr->integer_indices,
lp_settings,
static_cast<bound_presolve_t<i_t, f_t>*>(nullptr));
raft::copy(sol.assignment.data(),
init_sol_assignment.data(),
init_sol_assignment.size(),
sol.handle_ptr->get_stream());
bool is_feasible = sol.compute_feasibility();
Comment thread
nguidotti marked this conversation as resolved.
if (!is_feasible) {
raft::copy(sol.assignment.data(),
init_sol_assignment.data(),
init_sol_assignment.size(),
sol.handle_ptr->get_stream());
is_feasible = sol.compute_feasibility();
}

cuopt_func_call(sol.test_variable_bounds(true));
CUOPT_LOG_DEBUG("Adding initial solution success! feas %d objective %f excess %f",
is_feasible,
Expand All @@ -264,9 +272,8 @@ void diversity_manager_t<i_t, f_t>::add_user_given_solutions(
initial_sol_vector.emplace_back(std::move(sol));
} else {
CUOPT_LOG_ERROR(
"Error cannot add the provided initial solution! \
Assignment size %lu \
initial solution size %lu",
"Error cannot add the provided initial solution! Assignment size %lu initial solution size "
"%lu",
sol.assignment.size(),
init_sol_assignment.size());
}
Expand Down
7 changes: 7 additions & 0 deletions cpp/src/mip_heuristics/problem/problem.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,13 @@ void problem_t<i_t, f_t>::fix_given_variables(problem_t<i_t, f_t>& original_prob
variables_to_fix.end(),
[variable_fix_mask = make_span(fixing_helpers.variable_fix_mask)] __device__(
i_t x) { variable_fix_mask[x] = 1; });
cuopt_func_call(thrust::for_each(handle_ptr->get_thrust_policy(),
variables_to_fix.begin(),
variables_to_fix.end(),
[assignment = make_span(assignment)] __device__(i_t x) {
cuopt_assert(isfinite(assignment[x]),
"Fixing a variable to a non-finite value");
}));
const i_t num_segments = original_problem.n_constraints;
f_t initial_value{0.};

Expand Down
Loading