14 #ifndef OR_TOOLS_FLATZINC_MODEL_H_ 15 #define OR_TOOLS_FLATZINC_MODEL_H_ 21 #include "absl/container/flat_hash_map.h" 55 static Domain Interval(int64_t included_min, int64_t included_max);
78 int64_t
Value()
const;
130 bool Merge(
const std::string& other_name,
const Domain& other_domain,
131 bool other_temporary);
149 Variable(
const std::string& name_,
const Domain& domain_,
bool temporary_);
188 int64_t
Value()
const;
197 int64_t
ValueAt(
int pos)
const;
272 std::vector<Annotation> args);
302 Bounds(int64_t min_value_, int64_t max_value_)
317 const std::string&
name, std::vector<Bounds>
bounds,
336 : name_(
name), objective_(nullptr), maximize_(true) {}
348 void AddConstraint(
const std::string&
id, std::vector<Argument> arguments,
350 void AddConstraint(
const std::string&
id, std::vector<Argument> arguments);
364 const std::vector<Variable*>&
variables()
const {
return variables_; }
365 const std::vector<Constraint*>&
constraints()
const {
return constraints_; }
367 return search_annotations_;
374 const std::vector<SolutionOutputSpecs>&
output()
const {
return output_; }
387 const std::string&
name()
const {
return name_; }
390 const std::string name_;
393 std::vector<Variable*> variables_;
396 std::vector<Constraint*> constraints_;
401 std::vector<Annotation> search_annotations_;
402 std::vector<SolutionOutputSpecs> output_;
410 : model_(
model), logger_(logger) {}
412 return constraints_per_variables_[
var].size();
420 std::map<std::string, std::vector<Constraint*>> constraints_per_type_;
421 absl::flat_hash_map<const Variable*, std::vector<Constraint*>>
422 constraints_per_variables_;
431 #endif // OR_TOOLS_FLATZINC_MODEL_H_ std::vector< double > floats
Constraint(const std::string &t, std::vector< Argument > args, bool strong_propag)
static Argument FromDomain(const Domain &domain)
static Argument FloatInterval(double lb, double ub)
std::vector< double > float_values
static Argument FloatList(std::vector< double > floats)
bool IsInconsistent() const
std::string DebugString() const
bool IntersectWithInterval(int64_t interval_min, int64_t interval_max)
static Domain IntegerValue(int64_t value)
Variable * AddConstant(int64_t value)
std::vector< Bounds > bounds
bool OverlapsIntInterval(int64_t lb, int64_t ub) const
static Domain SetOfInterval(int64_t included_min, int64_t included_max)
static Annotation Identifier(const std::string &id)
void FlattenAnnotations(const Annotation &ann, std::vector< Annotation > *out)
std::string DebugString() const
static SolutionOutputSpecs SingleVariable(const std::string &name, Variable *variable, bool display_as_boolean)
void Minimize(Variable *obj, std::vector< Annotation > search_annotations)
void Maximize(Variable *obj, std::vector< Annotation > search_annotations)
int64_t ValueAt(int pos) const
bool IntersectWithSingleton(int64_t value)
bool Contains(int64_t value) const
static Domain SetOfIntegerList(std::vector< int64_t > values)
std::vector< Domain > domains
std::string DebugString() const
Bounds(int64_t min_value_, int64_t max_value_)
static Domain SetOfAllInt64()
static Domain Interval(int64_t included_min, int64_t included_max)
void AppendAllVariables(std::vector< Variable * > *vars) const
std::string DebugString() const
std::string DebugString() const
bool OverlapsIntList(const std::vector< int64_t > &vec) const
const std::vector< SolutionOutputSpecs > & output() const
bool IsFunctionCallWithIdentifier(const std::string &identifier) const
static Annotation FunctionCall(const std::string &id)
static Annotation Interval(int64_t interval_min, int64_t interval_max)
bool IntersectWithListOfIntegers(const std::vector< int64_t > &integers)
static Domain EmptyDomain()
static Argument IntegerValue(int64_t value)
const std::string & name() const
static Annotation IntegerValue(int64_t value)
static Annotation VarRefArray(std::vector< Variable * > variables)
static Annotation AnnotationList(std::vector< Annotation > list)
void AddOutput(SolutionOutputSpecs output)
bool Contains(int64_t value) const
std::vector< Variable * > variables
bool Merge(const std::string &other_name, const Domain &other_domain, bool other_temporary)
void PrintStatistics() const
const std::vector< Constraint * > & constraints() const
Variable * VarAt(int pos) const
ModelStatistics(const Model &model, SolverLogger *logger)
static Argument VarRefArray(std::vector< Variable * > vars)
std::vector< int64_t > values
static Domain SetOfBoolean()
static SolutionOutputSpecs MultiDimensionalArray(const std::string &name, std::vector< Bounds > bounds, std::vector< Variable * > flat_variables, bool display_as_boolean)
util::MutableVectorIteration< SolutionOutputSpecs > mutable_output()
static Domain IntegerList(std::vector< int64_t > values)
static Argument VoidArgument()
static SolutionOutputSpecs VoidOutput()
Model(const std::string &name)
bool SetEmptyFloatDomain()
static Annotation VarRef(Variable *const var)
static Argument VarRef(Variable *const var)
Variable * objective() const
static Domain AllFloats()
static Argument DomainList(std::vector< Domain > domains)
Variable * AddFloatConstant(double value)
util::MutableVectorIteration< Annotation > mutable_search_annotations()
bool RemoveValue(int64_t value)
void Satisfy(std::vector< Annotation > search_annotations)
std::vector< Annotation > annotations
Collection of objects used to extend the Constraint Solver library.
void SetObjective(Variable *obj)
static Annotation Empty()
static Domain FloatInterval(double lb, double ub)
std::vector< Variable * > variables
static Argument FloatValue(double value)
std::vector< Argument > arguments
static Domain FloatValue(double value)
Variable * AddVariable(const std::string &name, const Domain &domain, bool defined)
bool IntersectWithFloatDomain(const Domain &domain)
static Annotation FunctionCallWithArguments(const std::string &id, std::vector< Annotation > args)
const std::vector< Annotation > & search_annotations() const
static Argument Interval(int64_t imin, int64_t imax)
bool IntersectWithDomain(const Domain &domain)
void RemoveArg(int arg_pos)
static Argument IntegerList(std::vector< int64_t > values)
const std::vector< Variable * > & variables() const
static Domain SetOfIntegerValue(int64_t value)
std::vector< Variable * > flat_variables
static Annotation String(const std::string &str)
bool presolve_propagation_done
std::string DebugString() const
std::string DebugString() const
std::vector< int64_t > values
bool IsArrayOfValues() const
std::string DebugString() const
void AddConstraint(const std::string &id, std::vector< Argument > arguments, bool is_domain)
int NumVariableOccurrences(Variable *var)
bool OverlapsDomain(const Domain &other) const