Skip to content

Commit cf58b37

Browse files
committed
fix flakyness
1 parent c49f829 commit cf58b37

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

ortools/math_opt/solver_tests/ip_parameter_tests.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,9 +1273,12 @@ TEST_P(LargeInstanceIpParameterTest, AbsoluteGapTolerance) {
12731273
}
12741274
ASSERT_THAT(result, IsOkAndHolds(IsOptimal()));
12751275
// There should be some space between our optimal solution and best bound
1276-
EXPECT_GE(result->termination.objective_bounds.primal_bound -
1277-
result->termination.objective_bounds.dual_bound,
1278-
absolute_lp_relax_gap / 40.0);
1276+
if (GetParam().solver_type != SolverType::kCpSat) {
1277+
// CP-SAT in parallel can find the optimal solution directly.
1278+
EXPECT_GE(result->termination.objective_bounds.primal_bound -
1279+
result->termination.objective_bounds.dual_bound,
1280+
absolute_lp_relax_gap / 40.0);
1281+
}
12791282
}
12801283

12811284
// Set the relative gap to 2*(8090 - 7649)/8090 ~= 0.1 and check there is

ortools/sat/cp_model_solver_test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ TEST(SolveCpModelTest, NonInstantiatedVariables) {
294294
params.set_instantiate_all_variables(false);
295295
params.set_search_branching(SatParameters::FIXED_SEARCH);
296296
params.set_cp_model_presolve(false);
297+
params.set_num_workers(1);
297298
model.Add(NewSatParameters(params));
298299

299300
const CpSolverResponse response = SolveCpModel(model_proto, &model);

0 commit comments

Comments
 (0)