Skip to content

Commit 83d80a6

Browse files
committed
scheduling: add compressed testdata
1 parent 62076bd commit 83d80a6

5 files changed

Lines changed: 22 additions & 2 deletions

File tree

ortools/scheduling/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ cc_test(
113113
"//ortools/scheduling/testdata:1010_1_3",
114114
"//ortools/scheduling/testdata:50_10_01_ta041.txt",
115115
"//ortools/scheduling/testdata:SDST10_ta001.txt",
116+
"//ortools/scheduling/testdata:SDST10_ta001.txt.gz",
116117
"//ortools/scheduling/testdata:ft06",
117118
"//ortools/scheduling/testdata:jb1.txt",
118119
"//ortools/scheduling/testdata:taillard-jobshop-15_15-1_225_100_150-1",

ortools/scheduling/jobshop_scheduling_parser.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,14 @@ bool JsspParser::ParseFile(absl::string_view filename) {
6262
// - fjs suffix -> Flexible Jobshop
6363
// - txt suffix -> Taillard or time dependent scheduling.
6464

65-
if (absl::EndsWith(filename, "fjs")) {
65+
if (absl::EndsWith(filename, "fjs") || absl::EndsWith(filename, "fjs.bz2") ||
66+
absl::EndsWith(filename, "fjs.gz") ||
67+
absl::EndsWith(filename, "fjs.xz")) {
6668
problem_type_ = FLEXIBLE;
67-
} else if (absl::EndsWith(filename, ".txt")) {
69+
} else if (absl::EndsWith(filename, ".txt") ||
70+
absl::EndsWith(filename, ".txt.bz2") ||
71+
absl::EndsWith(filename, ".txt.gz") ||
72+
absl::EndsWith(filename, ".txt.xz")) {
6873
problem_type_ = TAILLARD;
6974
} else {
7075
problem_type_ = JSSP;

ortools/scheduling/jobshop_scheduling_parser_test.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@ TEST(RcpspParserTest, Sdst) {
6767
}
6868
}
6969

70+
TEST(RcpspParserTest, CompressedSdst) {
71+
JsspParser parser;
72+
ASSERT_TRUE(parser.ParseFile(GetPath("SDST10_ta001.txt.gz")));
73+
const JsspInputProblem problem = parser.problem();
74+
EXPECT_EQ(20, problem.jobs_size());
75+
EXPECT_EQ(5, problem.machines_size());
76+
for (const Machine& m : problem.machines()) {
77+
ASSERT_TRUE(m.has_transition_time_matrix());
78+
EXPECT_EQ(m.transition_time_matrix().transition_time_size(),
79+
problem.jobs_size() * problem.jobs_size());
80+
}
81+
}
82+
7083
TEST(RcpspParserTest, Tardiness) {
7184
JsspParser parser;
7285
ASSERT_TRUE(parser.ParseFile(GetPath("jb1.txt")));

ortools/scheduling/testdata/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ exports_files(
1919
"1010_1_3",
2020
"50_10_01_ta041.txt",
2121
"SDST10_ta001.txt",
22+
"SDST10_ta001.txt.gz",
2223
"c1510_1.mm.txt",
2324
"ft06",
2425
"j301_1.sm",
1.67 KB
Binary file not shown.

0 commit comments

Comments
 (0)