Google OR-Tools v9.9
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
fz.cc File Reference
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <ostream>
#include <string>
#include <vector>
#include "absl/flags/flag.h"
#include "absl/log/check.h"
#include "absl/log/initialize.h"
#include "absl/strings/match.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/logging.h"
#include "ortools/base/path.h"
#include "ortools/base/timer.h"
#include "ortools/flatzinc/cp_model_fz_solver.h"
#include "ortools/flatzinc/model.h"
#include "ortools/flatzinc/parser.h"
#include "ortools/flatzinc/presolve.h"
#include "ortools/util/logging.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.
 
namespace  operations_research::fz
 

Functions

 ABSL_FLAG (double, time_limit, 0, "time limit in seconds.")
 
 ABSL_FLAG (bool, search_all_solutions, false, "Search for all solutions.")
 
 ABSL_FLAG (bool, display_all_solutions, false, "Display all improving solutions.")
 
 ABSL_FLAG (bool, free_search, false, "If false, the solver must follow the defined search." "If true, other search are allowed.")
 
 ABSL_FLAG (int, threads, 0, "Number of threads the solver will use.")
 
 ABSL_FLAG (bool, presolve, true, "Presolve the model to simplify it.")
 
 ABSL_FLAG (bool, statistics, false, "Print solver statistics after search.")
 
 ABSL_FLAG (bool, read_from_stdin, false, "Read the FlatZinc from stdin, not from a file.")
 
 ABSL_FLAG (int, fz_seed, 0, "Random seed")
 
 ABSL_FLAG (std::string, fz_model_name, "stdin", "Define problem name when reading from stdin.")
 
 ABSL_FLAG (std::string, params, "", "SatParameters as a text proto.")
 
 ABSL_FLAG (bool, fz_logging, false, "Print logging information from the flatzinc interpreter.")
 
 ABSL_FLAG (bool, ortools_mode, true, "Display solutions in the flatzinc format")
 
std::vector< char * > operations_research::fz::FixAndParseParameters (int *argc, char ***argv)
 
Model operations_research::fz::ParseFlatzincModel (const std::string &input, bool input_is_filename, SolverLogger *logger)
 
void operations_research::fz::LogInFlatzincFormat (const std::string &multi_line_input)
 
int main (int argc, char **argv)
 

Function Documentation

◆ ABSL_FLAG() [1/13]

ABSL_FLAG ( bool ,
display_all_solutions ,
false ,
"Display all improving solutions."  )

◆ ABSL_FLAG() [2/13]

ABSL_FLAG ( bool ,
free_search ,
false ,
"If false,
the solver must follow the defined search." "If true,
other search are allowed."  )

◆ ABSL_FLAG() [3/13]

ABSL_FLAG ( bool ,
fz_logging ,
false ,
"Print logging information from the flatzinc interpreter."  )

◆ ABSL_FLAG() [4/13]

ABSL_FLAG ( bool ,
ortools_mode ,
true ,
"Display solutions in the flatzinc format"  )

◆ ABSL_FLAG() [5/13]

ABSL_FLAG ( bool ,
presolve ,
true ,
"Presolve the model to simplify it."  )

◆ ABSL_FLAG() [6/13]

ABSL_FLAG ( bool ,
read_from_stdin ,
false ,
"Read the FlatZinc from stdin,
not from a file."  )

◆ ABSL_FLAG() [7/13]

ABSL_FLAG ( bool ,
search_all_solutions ,
false ,
"Search for all solutions."  )

◆ ABSL_FLAG() [8/13]

ABSL_FLAG ( bool ,
statistics ,
false ,
"Print solver statistics after search."  )

◆ ABSL_FLAG() [9/13]

ABSL_FLAG ( double ,
time_limit ,
0 ,
"time limit in seconds."  )

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 is the skeleton for the official flatzinc interpreter. Much of the functionalities are fixed (name of parameters, format of the input): see http://www.minizinc.org/downloads/doc-1.6/flatzinc-spec.pdf

◆ ABSL_FLAG() [10/13]

ABSL_FLAG ( int ,
fz_seed ,
0 ,
"Random seed"  )

◆ ABSL_FLAG() [11/13]

ABSL_FLAG ( int ,
threads ,
0 ,
"Number of threads the solver will use."  )

◆ ABSL_FLAG() [12/13]

ABSL_FLAG ( std::string ,
fz_model_name ,
"stdin" ,
"Define problem name when reading from stdin."  )

◆ ABSL_FLAG() [13/13]

ABSL_FLAG ( std::string ,
params ,
"" ,
"SatParameters as a text proto."  )

◆ main()

int main ( int argc,
char ** argv )

Flatzinc specifications require single dash parameters (-a, -f, -p). We need to fix parameters before parsing them.

We allow piping model through stdin.

log_to_stdout is disabled later.

Definition at line 189 of file fz.cc.