Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
solve_flow_model.cc File Reference
#include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <sstream>
#include <string>
#include <vector>
#include "absl/flags/flag.h"
#include "absl/status/status.h"
#include "absl/strings/match.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/file.h"
#include "ortools/base/filesystem.h"
#include "ortools/base/helpers.h"
#include "ortools/base/init_google.h"
#include "ortools/base/logging.h"
#include "ortools/base/timer.h"
#include "ortools/graph/flow_problem.pb.h"
#include "ortools/graph/graph.h"
#include "ortools/graph/max_flow.h"
#include "ortools/graph/min_cost_flow.h"
#include "ortools/util/filelineiter.h"
#include "ortools/util/stats.h"

Go to the source code of this file.

Namespaces

namespace  operations_research
 In SWIG mode, we don't want anything besides these top-level includes.
 

Typedefs

typedef util::ReverseArcStaticGraph operations_research::Graph
 Type of graph to use.
 

Functions

 ABSL_FLAG (std::string, input, "", "Input file of the problem.")
 
 ABSL_FLAG (std::string, output_dimacs, "", "Output problem as a dimacs file.")
 
void operations_research::ConvertFlowModelToDimacs (const FlowModelProto &flow_model, std::string *dimacs)
 
bool operations_research::ConvertDimacsToFlowModel (absl::string_view file, FlowModelProto *flow_model)
 
void operations_research::SolveMinCostFlow (const FlowModelProto &flow_model, double *loading_time, double *solving_time)
 Loads a FlowModelProto proto into the MinCostFlow class and solves it.
 
void operations_research::SolveMaxFlow (const FlowModelProto &flow_model, double *loading_time, double *solving_time)
 Loads a FlowModelProto proto into the MaxFlow class and solves it.
 
int main (int argc, char **argv)
 

Function Documentation

◆ ABSL_FLAG() [1/2]

ABSL_FLAG ( std::string ,
input ,
"" ,
"Input file of the problem."  )

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. This code loads flow-graph models (as Dimacs file or binary FlowModel proto) and solves them with the OR-tools flow algorithms.

Note(user): only min-cost flow is supported at this point.

Todo
(user): move this DIMACS parser to its own class, like the ones in routing/. This change would improve searchability of the parser.

◆ ABSL_FLAG() [2/2]

ABSL_FLAG ( std::string ,
output_dimacs ,
"" ,
"Output problem as a dimacs file."  )

◆ main()

int main ( int argc,
char ** argv )

Parse the input as a proto.

Todo
(user): improve code to convert many files.

Definition at line 284 of file solve_flow_model.cc.