@@ -1857,6 +1857,53 @@ TEST(MapperRoundtrip, ProblemWithVariableTypes)
18571857 EXPECT_DOUBLE_EQ (restored_obj[2 ], 3.0 );
18581858}
18591859
1860+ TEST (MapperRoundtrip, UnaryProblemObjectiveScalingPresence)
1861+ {
1862+ cuopt::remote::OptimizationProblem omitted;
1863+ omitted.add_c (0.0 );
1864+ omitted.add_variable_lower_bounds (0.0 );
1865+ omitted.add_variable_upper_bounds (1.0 );
1866+ ASSERT_FALSE (omitted.has_objective_scaling_factor ());
1867+
1868+ cpu_optimization_problem_t <int32_t , double > restored_default;
1869+ map_proto_to_problem (omitted, restored_default);
1870+ EXPECT_DOUBLE_EQ (restored_default.get_objective_scaling_factor (), 1.0 );
1871+
1872+ cpu_optimization_problem_t <int32_t , double > orig;
1873+ const std::vector<double > objective{0.0 };
1874+ const std::vector<double > lower_bound{0.0 };
1875+ const std::vector<double > upper_bound{1.0 };
1876+ orig.set_objective_coefficients (objective.data (), objective.size ());
1877+ orig.set_variable_lower_bounds (lower_bound.data (), lower_bound.size ());
1878+ orig.set_variable_upper_bounds (upper_bound.data (), upper_bound.size ());
1879+ orig.set_objective_scaling_factor (2.5 );
1880+ cuopt::remote::OptimizationProblem present;
1881+ map_problem_to_proto (orig, &present);
1882+ ASSERT_TRUE (present.has_objective_scaling_factor ());
1883+ EXPECT_DOUBLE_EQ (present.objective_scaling_factor (), 2.5 );
1884+
1885+ cpu_optimization_problem_t <int32_t , double > restored_present;
1886+ map_proto_to_problem (present, restored_present);
1887+ EXPECT_DOUBLE_EQ (restored_present.get_objective_scaling_factor (), 2.5 );
1888+ }
1889+
1890+ TEST (MapperRoundtrip, ChunkedProblemObjectiveScalingPresence)
1891+ {
1892+ cuopt::remote::ChunkedProblemHeader omitted;
1893+ ASSERT_FALSE (omitted.has_objective_scaling_factor ());
1894+
1895+ cpu_optimization_problem_t <int32_t , double > restored_default;
1896+ map_chunked_header_to_problem (omitted, restored_default);
1897+ EXPECT_DOUBLE_EQ (restored_default.get_objective_scaling_factor (), 1.0 );
1898+
1899+ omitted.set_objective_scaling_factor (2.5 );
1900+ ASSERT_TRUE (omitted.has_objective_scaling_factor ());
1901+
1902+ cpu_optimization_problem_t <int32_t , double > restored_present;
1903+ map_chunked_header_to_problem (omitted, restored_present);
1904+ EXPECT_DOUBLE_EQ (restored_present.get_objective_scaling_factor (), 2.5 );
1905+ }
1906+
18601907TEST (MapperRoundtrip, MIPSolutionAllFields)
18611908{
18621909 std::vector<double > sol_vec = {1.0 , 0.0 , 1.0 , 0.0 , 1.0 };
0 commit comments