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"
18
#include "
ortools/base/integral_types.h
"
19
#include "ortools/data/jobshop_scheduling.pb.h"
20
21
namespace
operations_research
{
22
namespace
data {
23
namespace
jssp {
24
25
class
JsspParser
{
26
public
:
27
enum
ProblemType
{
28
UNDEFINED
,
29
JSSP
,
30
TAILLARD
,
31
FLEXIBLE
,
32
SDST
,
33
TARDINESS
,
34
PSS
,
35
EARLY_TARDY
,
36
};
37
38
enum
ParserState
{
39
START
,
40
JOB_COUNT_READ
,
41
MACHINE_COUNT_READ
,
42
SEED_READ
,
43
JOB_ID_READ
,
44
JOB_LENGTH_READ
,
45
JOB_READ
,
46
NAME_READ
,
47
JOBS_READ
,
48
SSD_READ
,
49
MACHINE_READ
,
50
PARSING_ERROR
,
51
DONE
52
};
53
54
~JsspParser
() {}
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_
operations_research::data::jssp::JsspParser
Definition:
jobshop_scheduling_parser.h:25
operations_research::data::jssp::JsspParser::problem
const JsspInputProblem & problem() const
Definition:
jobshop_scheduling_parser.h:61
operations_research::data::jssp::JsspParser::ParseFile
bool ParseFile(const std::string &filename)
Definition:
jobshop_scheduling_parser.cc:53
operations_research::data::jssp::JsspParser::ProblemType
ProblemType
Definition:
jobshop_scheduling_parser.h:27
operations_research::data::jssp::JsspParser::SDST
@ SDST
Definition:
jobshop_scheduling_parser.h:32
operations_research::data::jssp::JsspParser::JSSP
@ JSSP
Definition:
jobshop_scheduling_parser.h:29
operations_research::data::jssp::JsspParser::UNDEFINED
@ UNDEFINED
Definition:
jobshop_scheduling_parser.h:28
operations_research::data::jssp::JsspParser::PSS
@ PSS
Definition:
jobshop_scheduling_parser.h:34
operations_research::data::jssp::JsspParser::TAILLARD
@ TAILLARD
Definition:
jobshop_scheduling_parser.h:30
operations_research::data::jssp::JsspParser::TARDINESS
@ TARDINESS
Definition:
jobshop_scheduling_parser.h:33
operations_research::data::jssp::JsspParser::FLEXIBLE
@ FLEXIBLE
Definition:
jobshop_scheduling_parser.h:31
operations_research::data::jssp::JsspParser::EARLY_TARDY
@ EARLY_TARDY
Definition:
jobshop_scheduling_parser.h:35
operations_research::data::jssp::JsspParser::ParserState
ParserState
Definition:
jobshop_scheduling_parser.h:38
operations_research::data::jssp::JsspParser::START
@ START
Definition:
jobshop_scheduling_parser.h:39
operations_research::data::jssp::JsspParser::SSD_READ
@ SSD_READ
Definition:
jobshop_scheduling_parser.h:48
operations_research::data::jssp::JsspParser::MACHINE_COUNT_READ
@ MACHINE_COUNT_READ
Definition:
jobshop_scheduling_parser.h:41
operations_research::data::jssp::JsspParser::JOB_ID_READ
@ JOB_ID_READ
Definition:
jobshop_scheduling_parser.h:43
operations_research::data::jssp::JsspParser::JOB_READ
@ JOB_READ
Definition:
jobshop_scheduling_parser.h:45
operations_research::data::jssp::JsspParser::JOB_LENGTH_READ
@ JOB_LENGTH_READ
Definition:
jobshop_scheduling_parser.h:44
operations_research::data::jssp::JsspParser::JOBS_READ
@ JOBS_READ
Definition:
jobshop_scheduling_parser.h:47
operations_research::data::jssp::JsspParser::SEED_READ
@ SEED_READ
Definition:
jobshop_scheduling_parser.h:42
operations_research::data::jssp::JsspParser::MACHINE_READ
@ MACHINE_READ
Definition:
jobshop_scheduling_parser.h:49
operations_research::data::jssp::JsspParser::JOB_COUNT_READ
@ JOB_COUNT_READ
Definition:
jobshop_scheduling_parser.h:40
operations_research::data::jssp::JsspParser::DONE
@ DONE
Definition:
jobshop_scheduling_parser.h:51
operations_research::data::jssp::JsspParser::PARSING_ERROR
@ PARSING_ERROR
Definition:
jobshop_scheduling_parser.h:50
operations_research::data::jssp::JsspParser::NAME_READ
@ NAME_READ
Definition:
jobshop_scheduling_parser.h:46
operations_research::data::jssp::JsspParser::~JsspParser
~JsspParser()
Definition:
jobshop_scheduling_parser.h:54
integral_types.h
int64
int64_t int64
Definition:
integral_types.h:34
operations_research
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
Definition:
dense_doubly_linked_list.h:21
ortools
data
jobshop_scheduling_parser.h
Generated by
1.9.4