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;
276 std::vector<Annotation> args);
306 Bounds(int64_t min_value_, int64_t max_value_)
321 const std::string&
name, std::vector<Bounds>
bounds,
340 : name_(
name), objective_(nullptr), maximize_(true) {}
352 void AddConstraint(
const std::string&
id, std::vector<Argument> arguments,
354 void AddConstraint(
const std::string&
id, std::vector<Argument> arguments);
368 const std::vector<Variable*>&
variables()
const {
return variables_; }
369 const std::vector<Constraint*>&
constraints()
const {
return constraints_; }
371 return search_annotations_;
378 const std::vector<SolutionOutputSpecs>&
output()
const {
return output_; }
391 const std::string&
name()
const {
return name_; }
394 const std::string name_;
397 std::vector<Variable*> variables_;
400 std::vector<Constraint*> constraints_;
405 std::vector<Annotation> search_annotations_;
406 std::vector<SolutionOutputSpecs> output_;
414 : model_(
model), logger_(logger) {}
416 return constraints_per_variables_[
var].size();
424 std::map<std::string, std::vector<Constraint*>> constraints_per_type_;
425 absl::flat_hash_map<const Variable*, std::vector<Constraint*>>
426 constraints_per_variables_;
util::MutableVectorIteration< SolutionOutputSpecs > mutable_output()
const std::string & name() const
const std::vector< Annotation > & search_annotations() const
Variable * AddVariable(const std::string &name, const Domain &domain, bool defined)
const std::vector< SolutionOutputSpecs > & output() const
Model(const std::string &name)
void SetObjective(Variable *obj)
Variable * AddConstant(int64_t value)
void Satisfy(std::vector< Annotation > search_annotations)
std::string DebugString() const
void AddOutput(SolutionOutputSpecs output)
util::MutableVectorIteration< Annotation > mutable_search_annotations()
void AddConstraint(const std::string &id, std::vector< Argument > arguments, bool is_domain)
Variable * objective() const
void Maximize(Variable *obj, std::vector< Annotation > search_annotations)
bool IsInconsistent() const
void Minimize(Variable *obj, std::vector< Annotation > search_annotations)
Variable * AddFloatConstant(double value)
const std::vector< Constraint * > & constraints() const
const std::vector< Variable * > & variables() const
int NumVariableOccurrences(Variable *var)
void PrintStatistics() const
ModelStatistics(const Model &model, SolverLogger *logger)
void FlattenAnnotations(const Annotation &ann, std::vector< Annotation > *out)
Collection of objects used to extend the Constraint Solver library.
static Annotation IntegerValue(int64_t value)
void AppendAllVariables(std::vector< Variable * > *vars) const
std::string DebugString() const
static Annotation FunctionCall(const std::string &id)
static Annotation AnnotationList(std::vector< Annotation > list)
std::vector< Variable * > variables
static Annotation String(const std::string &str)
static Annotation Identifier(const std::string &id)
bool IsFunctionCallWithIdentifier(const std::string &identifier) const
std::vector< Annotation > annotations
static Annotation Interval(int64_t interval_min, int64_t interval_max)
static Annotation VarRefArray(std::vector< Variable * > variables)
static Annotation VarRef(Variable *const var)
static Annotation Empty()
static Annotation FunctionCallWithArguments(const std::string &id, std::vector< Annotation > args)
static Argument FloatInterval(double lb, double ub)
static Argument DomainList(std::vector< Domain > domains)
Variable * VarAt(int pos) const
static Argument VarRef(Variable *const var)
std::vector< double > floats
bool Contains(int64_t value) const
static Argument IntegerList(std::vector< int64_t > values)
static Argument VoidArgument()
static Argument VarRefArray(std::vector< Variable * > vars)
static Argument IntegerValue(int64_t value)
static Argument Interval(int64_t imin, int64_t imax)
std::string DebugString() const
std::vector< Variable * > variables
static Argument FloatValue(double value)
std::vector< Domain > domains
bool HasOneValueAt(int pos) const
std::vector< int64_t > values
int64_t ValueAt(int pos) const
static Argument FloatList(std::vector< double > floats)
bool IsArrayOfValues() const
static Argument FromDomain(const Domain &domain)
Constraint(const std::string &t, std::vector< Argument > args, bool strong_propag)
bool presolve_propagation_done
void RemoveArg(int arg_pos)
std::string DebugString() const
std::vector< Argument > arguments
static Domain IntegerValue(int64_t value)
static Domain EmptyDomain()
bool Contains(int64_t value) const
bool SetEmptyFloatDomain()
bool OverlapsDomain(const Domain &other) const
static Domain SetOfAllInt64()
bool IntersectWithSingleton(int64_t value)
static Domain SetOfInterval(int64_t included_min, int64_t included_max)
static Domain IntegerList(std::vector< int64_t > values)
std::string DebugString() const
bool IntersectWithInterval(int64_t interval_min, int64_t interval_max)
bool IntersectWithFloatDomain(const Domain &domain)
bool IntersectWithDomain(const Domain &domain)
std::vector< double > float_values
static Domain FloatInterval(double lb, double ub)
bool OverlapsIntInterval(int64_t lb, int64_t ub) const
static Domain SetOfIntegerValue(int64_t value)
bool OverlapsIntList(const std::vector< int64_t > &vec) const
static Domain Interval(int64_t included_min, int64_t included_max)
std::vector< int64_t > values
static Domain SetOfBoolean()
static Domain SetOfIntegerList(std::vector< int64_t > values)
static Domain FloatValue(double value)
bool IntersectWithListOfIntegers(const std::vector< int64_t > &integers)
static Domain AllFloats()
bool RemoveValue(int64_t value)
Bounds(int64_t min_value_, int64_t max_value_)
std::string DebugString() const
static SolutionOutputSpecs VoidOutput()
std::string DebugString() const
static SolutionOutputSpecs SingleVariable(const std::string &name, Variable *variable, bool display_as_boolean)
std::vector< Variable * > flat_variables
std::vector< Bounds > bounds
static SolutionOutputSpecs MultiDimensionalArray(const std::string &name, std::vector< Bounds > bounds, std::vector< Variable * > flat_variables, bool display_as_boolean)
std::string DebugString() const
bool Merge(const std::string &other_name, const Domain &other_domain, bool other_temporary)