Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
jobshop_scheduling_parser.h
Go to the documentation of this file.
1// Copyright 2010-2024 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14#ifndef OR_TOOLS_SCHEDULING_JOBSHOP_SCHEDULING_PARSER_H_
15#define OR_TOOLS_SCHEDULING_JOBSHOP_SCHEDULING_PARSER_H_
16
17#include <cstdint>
18#include <string>
19
20#include "absl/strings/match.h"
21#include "absl/strings/string_view.h"
22#include "ortools/base/types.h"
23#include "ortools/scheduling/jobshop_scheduling.pb.h"
24
25namespace operations_research {
26namespace scheduling {
27namespace jssp {
28
30 public:
41
57
58 ~JsspParser() = default;
59
60 // Parses a file to load a jobshop problem.
61 // Tries to auto detect the file format.
62 bool ParseFile(absl::string_view filename);
63
64 // Returns the loaded problem.
65 const JsspInputProblem& problem() const { return problem_; }
66
67 private:
68 void ProcessJsspLine(const std::string& line);
69 void ProcessTaillardLine(const std::string& line);
70 void ProcessFlexibleLine(const std::string& line);
71 void ProcessSdstLine(const std::string& line);
72 void ProcessTardinessLine(const std::string& line);
73 void ProcessPssLine(const std::string& line);
74 void ProcessEarlyTardyLine(const std::string& line);
75
76 void SetJobs(int job_count);
77 void SetMachines(int machine_count);
78 int strtoint32(absl::string_view word);
79 int64_t strtoint64(absl::string_view word);
80
81 JsspInputProblem problem_;
82 int declared_machine_count_ = -1;
83 int declared_job_count_ = -1;
84 int current_job_index_ = 0;
85 int current_machine_index_ = 0;
86 int transition_index_ = 0;
87 ProblemType problem_type_ = UNDEFINED;
88 ParserState parser_state_ = START;
89};
90
91} // namespace jssp
92} // namespace scheduling
93} // namespace operations_research
94
95#endif // OR_TOOLS_SCHEDULING_JOBSHOP_SCHEDULING_PARSER_H_
const JsspInputProblem & problem() const
Returns the loaded problem.
In SWIG mode, we don't want anything besides these top-level includes.
int line