OR-Tools
9.6
jobshop_scheduling_parser.h
Go to the documentation of this file.
1
// Copyright 2010-2022 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 "
ortools/base/integral_types.h
"
22
#include "ortools/scheduling/jobshop_scheduling.pb.h"
23
24
namespace
operations_research
{
25
namespace
scheduling {
26
namespace
jssp {
27
28
class
JsspParser
{
29
public
:
30
enum
ProblemType
{
31
UNDEFINED
,
32
JSSP
,
33
TAILLARD
,
34
FLEXIBLE
,
35
SDST
,
36
TARDINESS
,
37
PSS
,
38
EARLY_TARDY
,
39
};
40
41
enum
ParserState
{
42
START
,
43
JOB_COUNT_READ
,
44
MACHINE_COUNT_READ
,
45
SEED_READ
,
46
JOB_ID_READ
,
47
JOB_LENGTH_READ
,
48
JOB_READ
,
49
NAME_READ
,
50
JOBS_READ
,
51
SSD_READ
,
52
MACHINE_READ
,
53
PARSING_ERROR
,
54
DONE
55
};
56
57
~JsspParser
() {}
58
59
// Parses a file to load a jobshop problem.
60
// Tries to auto detect the file format.
61
bool
ParseFile
(
const
std::string& filename);
62
63
// Returns the loaded problem.
64
const
JsspInputProblem&
problem
()
const
{
return
problem_; }
65
66
private
:
67
void
ProcessJsspLine(
const
std::string&
line
);
68
void
ProcessTaillardLine(
const
std::string&
line
);
69
void
ProcessFlexibleLine(
const
std::string&
line
);
70
void
ProcessSdstLine(
const
std::string&
line
);
71
void
ProcessTardinessLine(
const
std::string&
line
);
72
void
ProcessPssLine(
const
std::string&
line
);
73
void
ProcessEarlyTardyLine(
const
std::string&
line
);
74
75
void
SetJobs(
int
job_count);
76
void
SetMachines(
int
machine_count);
77
int
strtoint32(
const
std::string& word);
78
int64_t strtoint64(
const
std::string& word);
79
80
JsspInputProblem problem_;
81
int
declared_machine_count_ = -1;
82
int
declared_job_count_ = -1;
83
int
current_job_index_ = 0;
84
int
current_machine_index_ = 0;
85
int
transition_index_ = 0;
86
ProblemType
problem_type_ =
UNDEFINED
;
87
ParserState
parser_state_ =
START
;
88
};
89
90
}
// namespace jssp
91
}
// namespace scheduling
92
}
// namespace operations_research
93
94
#endif
// OR_TOOLS_SCHEDULING_JOBSHOP_SCHEDULING_PARSER_H_
operations_research::scheduling::jssp::JsspParser
Definition:
jobshop_scheduling_parser.h:28
operations_research::scheduling::jssp::JsspParser::ParseFile
bool ParseFile(const std::string &filename)
Definition:
jobshop_scheduling_parser.cc:57
operations_research::scheduling::jssp::JsspParser::ProblemType
ProblemType
Definition:
jobshop_scheduling_parser.h:30
operations_research::scheduling::jssp::JsspParser::SDST
@ SDST
Definition:
jobshop_scheduling_parser.h:35
operations_research::scheduling::jssp::JsspParser::JSSP
@ JSSP
Definition:
jobshop_scheduling_parser.h:32
operations_research::scheduling::jssp::JsspParser::UNDEFINED
@ UNDEFINED
Definition:
jobshop_scheduling_parser.h:31
operations_research::scheduling::jssp::JsspParser::PSS
@ PSS
Definition:
jobshop_scheduling_parser.h:37
operations_research::scheduling::jssp::JsspParser::TAILLARD
@ TAILLARD
Definition:
jobshop_scheduling_parser.h:33
operations_research::scheduling::jssp::JsspParser::TARDINESS
@ TARDINESS
Definition:
jobshop_scheduling_parser.h:36
operations_research::scheduling::jssp::JsspParser::FLEXIBLE
@ FLEXIBLE
Definition:
jobshop_scheduling_parser.h:34
operations_research::scheduling::jssp::JsspParser::EARLY_TARDY
@ EARLY_TARDY
Definition:
jobshop_scheduling_parser.h:38
operations_research::scheduling::jssp::JsspParser::problem
const JsspInputProblem & problem() const
Definition:
jobshop_scheduling_parser.h:64
operations_research::scheduling::jssp::JsspParser::ParserState
ParserState
Definition:
jobshop_scheduling_parser.h:41
operations_research::scheduling::jssp::JsspParser::START
@ START
Definition:
jobshop_scheduling_parser.h:42
operations_research::scheduling::jssp::JsspParser::SSD_READ
@ SSD_READ
Definition:
jobshop_scheduling_parser.h:51
operations_research::scheduling::jssp::JsspParser::MACHINE_COUNT_READ
@ MACHINE_COUNT_READ
Definition:
jobshop_scheduling_parser.h:44
operations_research::scheduling::jssp::JsspParser::JOB_ID_READ
@ JOB_ID_READ
Definition:
jobshop_scheduling_parser.h:46
operations_research::scheduling::jssp::JsspParser::JOB_READ
@ JOB_READ
Definition:
jobshop_scheduling_parser.h:48
operations_research::scheduling::jssp::JsspParser::JOB_LENGTH_READ
@ JOB_LENGTH_READ
Definition:
jobshop_scheduling_parser.h:47
operations_research::scheduling::jssp::JsspParser::JOBS_READ
@ JOBS_READ
Definition:
jobshop_scheduling_parser.h:50
operations_research::scheduling::jssp::JsspParser::SEED_READ
@ SEED_READ
Definition:
jobshop_scheduling_parser.h:45
operations_research::scheduling::jssp::JsspParser::MACHINE_READ
@ MACHINE_READ
Definition:
jobshop_scheduling_parser.h:52
operations_research::scheduling::jssp::JsspParser::JOB_COUNT_READ
@ JOB_COUNT_READ
Definition:
jobshop_scheduling_parser.h:43
operations_research::scheduling::jssp::JsspParser::DONE
@ DONE
Definition:
jobshop_scheduling_parser.h:54
operations_research::scheduling::jssp::JsspParser::PARSING_ERROR
@ PARSING_ERROR
Definition:
jobshop_scheduling_parser.h:53
operations_research::scheduling::jssp::JsspParser::NAME_READ
@ NAME_READ
Definition:
jobshop_scheduling_parser.h:49
operations_research::scheduling::jssp::JsspParser::~JsspParser
~JsspParser()
Definition:
jobshop_scheduling_parser.h:57
integral_types.h
operations_research
Collection of objects used to extend the Constraint Solver library.
Definition:
dense_doubly_linked_list.h:21
line
int line
Definition:
parse_proto.cc:31
ortools
scheduling
jobshop_scheduling_parser.h
Generated by
1.9.1