OR-Tools  8.2
jobshop_scheduling_parser.h
Go to the documentation of this file.
1// Copyright 2010-2018 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_DATA_JOBSHOP_SCHEDULING_PARSER_H_
15#define OR_TOOLS_DATA_JOBSHOP_SCHEDULING_PARSER_H_
16
17#include "absl/strings/match.h"
19#include "ortools/data/jobshop_scheduling.pb.h"
20
21namespace operations_research {
22namespace data {
23namespace jssp {
24
26 public:
36 };
37
51 DONE
52 };
53
55
56 // Parses a file to load a jobshop problem.
57 // Tries to auto detect the file format.
58 bool ParseFile(const std::string& filename);
59
60 // Returns the loaded problem.
61 const JsspInputProblem& problem() const { return problem_; }
62
63 private:
64 void ProcessJsspLine(const std::string& line);
65 void ProcessTaillardLine(const std::string& line);
66 void ProcessFlexibleLine(const std::string& line);
67 void ProcessSdstLine(const std::string& line);
68 void ProcessTardinessLine(const std::string& line);
69 void ProcessPssLine(const std::string& line);
70 void ProcessEarlyTardyLine(const std::string& line);
71
72 void SetJobs(int job_count);
73 void SetMachines(int machine_count);
74 int strtoint32(const std::string& word);
75 int64 strtoint64(const std::string& word);
76
77 JsspInputProblem problem_;
78 int declared_machine_count_ = -1;
79 int declared_job_count_ = -1;
80 int current_job_index_ = 0;
81 int current_machine_index_ = 0;
82 int transition_index_ = 0;
83 ProblemType problem_type_ = UNDEFINED;
84 ParserState parser_state_ = START;
85};
86
87} // namespace jssp
88} // namespace data
89} // namespace operations_research
90
91#endif // OR_TOOLS_DATA_JOBSHOP_SCHEDULING_PARSER_H_
int64_t int64
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...