Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::fz Namespace Reference

Classes

struct  Annotation
 
struct  Argument
 
struct  Constraint
 
struct  Domain
 
struct  FlatzincSatParameters
 
struct  LexerInfo
 
class  Model
 
class  ModelStatistics
 
struct  ParserContext
 This is the context used during parsing. More...
 
class  Presolver
 
struct  SolutionOutputSpecs
 
struct  Variable
 
struct  VarRefOrValue
 

Functions

bool CheckSolution (const Model &model, const std::function< int64_t(Variable *)> &evaluator, SolverLogger *logger)
 
std::vector< char * > FixAndParseParameters (int *argc, char ***argv)
 
Model ParseFlatzincModel (const std::string &input, bool input_is_filename, SolverLogger *logger)
 
void LogInFlatzincFormat (const std::string &multi_line_input)
 
void FlattenAnnotations (const Annotation &ann, std::vector< Annotation > *out)
 Flatten Search annotations.
 
bool ParseFlatzincFile (const std::string &filename, Model *model)
 --— public parsing API --—
 
bool ParseFlatzincString (const std::string &input, Model *model)
 
void ParseFile (const std::string &filename, bool presolve)
 
bool ContainsId (std::vector< Annotation > *annotations, absl::string_view id)
 
bool AllDomainsHaveOneValue (const std::vector< Domain > &domains)
 
int64_t ConvertAsIntegerOrDie (double d)
 If the argument is an integer, return it as int64_t. Otherwise, die.
 
template<class T >
const T & Lookup (const std::vector< T > &v, int index)
 

Function Documentation

◆ AllDomainsHaveOneValue()

bool operations_research::fz::AllDomainsHaveOneValue ( const std::vector< Domain > & domains)

Definition at line 59 of file parser_util.cc.

◆ CheckSolution()

bool operations_research::fz::CheckSolution ( const Model & model,
const std::function< int64_t(Variable *)> & evaluator,
SolverLogger * logger )

Verifies that the solution specified by the given evaluator is a feasible solution of the given model. Returns true iff this is the case.

Definition at line 1325 of file checker.cc.

◆ ContainsId()

bool operations_research::fz::ContainsId ( std::vector< Annotation > * annotations,
absl::string_view id )

Whether the given list of annotations contains the given identifier (or function call).

Definition at line 46 of file parser_util.cc.

◆ ConvertAsIntegerOrDie()

int64_t operations_research::fz::ConvertAsIntegerOrDie ( double d)

If the argument is an integer, return it as int64_t. Otherwise, die.

Definition at line 68 of file parser_util.cc.

◆ FixAndParseParameters()

std::vector< char * > operations_research::fz::FixAndParseParameters ( int * argc,
char *** argv )

Fix time limit if -t was used.

Define the default number of workers to 1 if -f was used.

Definition at line 68 of file fz.cc.

◆ FlattenAnnotations()

void operations_research::fz::FlattenAnnotations ( const Annotation & ann,
std::vector< Annotation > * out )

Flatten Search annotations.

Helper method to flatten Search annotations.

Definition at line 1169 of file model.cc.

◆ LogInFlatzincFormat()

void operations_research::fz::LogInFlatzincFormat ( const std::string & multi_line_input)

Definition at line 172 of file fz.cc.

◆ Lookup()

template<class T >
const T & operations_research::fz::Lookup ( const std::vector< T > & v,
int index )

Array in flatzinc are 1 based. We use this trivial wrapper for all flatzinc arrays.

Todo
(user): replace this by a macro for better logging.

Definition at line 78 of file parser_util.cc.

◆ ParseFile()

void operations_research::fz::ParseFile ( const std::string & filename,
bool presolve )

Remove the .fzn extension.

Remove the leading path if present.

Definition at line 38 of file parser_main.cc.

◆ ParseFlatzincFile()

bool operations_research::fz::ParseFlatzincFile ( const std::string & filename,
Model * model )

--— public parsing API --—

Public parsing API.

Init.

Add known constants.

Parse.

Clean up.

Definition at line 42 of file parser.cc.

◆ ParseFlatzincModel()

Model operations_research::fz::ParseFlatzincModel ( const std::string & input,
bool input_is_filename,
SolverLogger * logger )

Check the extension.

Read model.

Presolve the model.

Print statistics.

Definition at line 131 of file fz.cc.

◆ ParseFlatzincString()

bool operations_research::fz::ParseFlatzincString ( const std::string & input,
Model * model )

Init.

Add known constants.

Parse.

Clean up.

Definition at line 67 of file parser.cc.