File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -927,14 +927,16 @@ optimization_problem_solution_t<i_t, f_t> solve_lp(
927927 settings.dual_postsolve ,
928928 op_problem.get_handle_ptr ()->get_stream ());
929929
930- thrust::fill (rmm::exec_policy (op_problem.get_handle_ptr ()->get_stream ()),
931- dual_solution.data (),
932- dual_solution.data () + dual_solution.size (),
933- std::numeric_limits<f_t >::signaling_NaN ());
934- thrust::fill (rmm::exec_policy (op_problem.get_handle_ptr ()->get_stream ()),
935- reduced_costs.data (),
936- reduced_costs.data () + reduced_costs.size (),
937- std::numeric_limits<f_t >::signaling_NaN ());
930+ if (!settings.dual_postsolve ) {
931+ thrust::fill (rmm::exec_policy (op_problem.get_handle_ptr ()->get_stream ()),
932+ dual_solution.data (),
933+ dual_solution.data () + dual_solution.size (),
934+ std::numeric_limits<f_t >::signaling_NaN ());
935+ thrust::fill (rmm::exec_policy (op_problem.get_handle_ptr ()->get_stream ()),
936+ reduced_costs.data (),
937+ reduced_costs.data () + reduced_costs.size (),
938+ std::numeric_limits<f_t >::signaling_NaN ());
939+ }
938940
939941 auto full_stats = solution.get_additional_termination_information ();
940942
Original file line number Diff line number Diff line change @@ -871,16 +871,14 @@ TEST(pdlp_class, dual_postsolve_size)
871871 solver_settings.method = cuopt::linear_programming::method_t ::PDLP;
872872 solver_settings.presolve = true ;
873873
874- // With dual_postsolve on, dual solution size should match number of constraints
875874 {
876875 solver_settings.dual_postsolve = true ;
877876 optimization_problem_solution_t <int , double > solution =
878877 solve_lp (&handle_, op_problem, solver_settings);
879878 EXPECT_EQ ((int )solution.get_termination_status (), CUOPT_TERIMINATION_STATUS_OPTIMAL);
880- EXPECT_EQ (solution.get_dual_solution ().size (), op_problem.get_n_variables ());
879+ EXPECT_EQ (solution.get_dual_solution ().size (), op_problem.get_n_constraints ());
881880 }
882881
883- // With dual_postsolve off, dual solution size should be 0
884882 {
885883 solver_settings.dual_postsolve = false ;
886884 optimization_problem_solution_t <int , double > solution =
You can’t perform that action at this time.
0 commit comments