Gecode::FlatZinc::FlatZincSpace Class Reference
A space that can be initialized with a FlatZinc model. More...
#include <flatzinc.hh>
Public Types | |
enum | Meth { SAT, MIN, MAX } |
Public Member Functions | |
FlatZincSpace (void) | |
Construct empty space. | |
~FlatZincSpace (void) | |
Destructor. | |
void | init (int intVars, int boolVars, int setVars) |
Initialize space with given number of variables. | |
void | newIntVar (IntVarSpec *vs) |
Create new integer variable from specification. | |
void | aliasBool2Int (int iv, int bv) |
Link integer variable iv to Boolean variable bv. | |
int | aliasBool2Int (int iv) |
Return linked Boolean variable for integer variable iv. | |
void | newBoolVar (BoolVarSpec *vs) |
Create new Boolean variable from specification. | |
void | newSetVar (SetVarSpec *vs) |
Create new set variable from specification. | |
void | postConstraint (const ConExpr &ce, AST::Node *annotation) |
Post a constraint specified by ce. | |
void | solve (AST::Array *annotation) |
Post the solve item. | |
void | minimize (int var, AST::Array *annotation) |
Post that integer variable var should be minimized. | |
void | maximize (int var, AST::Array *annotation) |
Post that integer variable var should be maximized. | |
void | run (std::ostream &out, const Printer &p, const FlatZincOptions &opt, Gecode::Support::Timer &t_total) |
Run the search. | |
void | print (std::ostream &out, const Printer &p) const |
Produce output on out using p. | |
void | shrinkArrays (Printer &p) |
Remove all variables not needed for output. | |
Meth | method (void) const |
Return whether to solve a satisfaction or optimization problem. | |
int | optVar (void) const |
Return index of variable used for optimization. | |
void | createBranchers (AST::Node *ann, bool ignoreUnknown, std::ostream &err=std::cerr) |
Create branchers corresponding to the solve item annotations. | |
AST::Array * | solveAnnotations (void) const |
Return the solve item annotations. | |
virtual void | constrain (const Space &s) |
Implement optimization. | |
virtual Gecode::Space * | copy (bool share) |
Copy function. | |
Public Attributes | |
Gecode::IntVarArray | iv |
The integer variables. | |
std::vector< bool > | iv_introduced |
Indicates whether an integer variable is introduced by mzn2fzn. | |
int * | iv_boolalias |
Indicates whether an integer variable aliases a Boolean variable. | |
Gecode::BoolVarArray | bv |
The Boolean variables. | |
std::vector< bool > | bv_introduced |
Indicates whether a Boolean variable is introduced by mzn2fzn. | |
Gecode::SetVarArray | sv |
The set variables. | |
std::vector< bool > | sv_introduced |
Indicates whether a set variable is introduced by mzn2fzn. | |
Protected Member Functions | |
FlatZincSpace (bool share, FlatZincSpace &) | |
Copy constructor. | |
Protected Attributes | |
int | intVarCount |
Number of integer variables. | |
int | boolVarCount |
Number of Boolean variables. | |
int | setVarCount |
Number of set variables. | |
int | _optVar |
Index of the integer variable to optimize. | |
Meth | _method |
Whether to solve as satisfaction or optimization problem. | |
AST::Array * | _solveAnnotations |
Annotations on the solve item. |
Detailed Description
A space that can be initialized with a FlatZinc model.
Definition at line 246 of file flatzinc.hh.
Member Enumeration Documentation
Definition at line 248 of file flatzinc.hh.
Constructor & Destructor Documentation
Gecode::FlatZinc::FlatZincSpace::FlatZincSpace | ( | bool | share, | |
FlatZincSpace & | f | |||
) | [protected] |
Copy constructor.
Definition at line 208 of file flatzinc.cpp.
Gecode::FlatZinc::FlatZincSpace::FlatZincSpace | ( | void | ) |
Construct empty space.
Definition at line 222 of file flatzinc.cpp.
Gecode::FlatZinc::FlatZincSpace::~FlatZincSpace | ( | void | ) |
Destructor.
Definition at line 540 of file flatzinc.cpp.
Member Function Documentation
void Gecode::FlatZinc::FlatZincSpace::init | ( | int | intVars, | |
int | boolVars, | |||
int | setVars | |||
) |
Initialize space with given number of variables.
Definition at line 227 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::newIntVar | ( | IntVarSpec * | vs | ) |
Create new integer variable from specification.
Definition at line 248 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::aliasBool2Int | ( | int | iv, | |
int | bv | |||
) |
Link integer variable iv to Boolean variable bv.
Definition at line 259 of file flatzinc.cpp.
int Gecode::FlatZinc::FlatZincSpace::aliasBool2Int | ( | int | iv | ) |
Return linked Boolean variable for integer variable iv.
Definition at line 263 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::newBoolVar | ( | BoolVarSpec * | vs | ) |
Create new Boolean variable from specification.
Definition at line 268 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::newSetVar | ( | SetVarSpec * | vs | ) |
Create new set variable from specification.
Definition at line 279 of file flatzinc.cpp.
Post a constraint specified by ce.
Definition at line 324 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::solve | ( | AST::Array * | annotation | ) |
Post the solve item.
Definition at line 499 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::minimize | ( | int | var, | |
AST::Array * | annotation | |||
) |
Post that integer variable var should be minimized.
Definition at line 505 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::maximize | ( | int | var, | |
AST::Array * | annotation | |||
) |
Post that integer variable var should be maximized.
Definition at line 523 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::run | ( | std::ostream & | out, | |
const Printer & | p, | |||
const FlatZincOptions & | opt, | |||
Gecode::Support::Timer & | t_total | |||
) |
Run the search.
Definition at line 754 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::print | ( | std::ostream & | out, | |
const Printer & | p | |||
) | const |
Produce output on out using p.
Definition at line 796 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::shrinkArrays | ( | Printer & | p | ) |
Remove all variables not needed for output.
After calling this function, no new constraints can be posted through FlatZinc variable references, and the createBranchers method must not be called again.
Definition at line 805 of file flatzinc.cpp.
FlatZincSpace::Meth Gecode::FlatZinc::FlatZincSpace::method | ( | void | ) | const |
Return whether to solve a satisfaction or optimization problem.
Definition at line 786 of file flatzinc.cpp.
int Gecode::FlatZinc::FlatZincSpace::optVar | ( | void | ) | const |
Return index of variable used for optimization.
Definition at line 791 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::createBranchers | ( | AST::Node * | ann, | |
bool | ignoreUnknown, | |||
std::ostream & | err = std::cerr | |||
) |
Create branchers corresponding to the solve item annotations.
If ignoreUnknown is true, unknown solve item annotations will be ignored, otherwise a warning is written to err.
Definition at line 349 of file flatzinc.cpp.
AST::Array * Gecode::FlatZinc::FlatZincSpace::solveAnnotations | ( | void | ) | const |
Return the solve item annotations.
Definition at line 494 of file flatzinc.cpp.
void Gecode::FlatZinc::FlatZincSpace::constrain | ( | const Space & | s | ) | [virtual] |
Implement optimization.
Reimplemented from Gecode::Space.
Definition at line 771 of file flatzinc.cpp.
Space * Gecode::FlatZinc::FlatZincSpace::copy | ( | bool | share | ) | [virtual] |
Member Data Documentation
int Gecode::FlatZinc::FlatZincSpace::intVarCount [protected] |
Number of integer variables.
Definition at line 255 of file flatzinc.hh.
int Gecode::FlatZinc::FlatZincSpace::boolVarCount [protected] |
Number of Boolean variables.
Definition at line 257 of file flatzinc.hh.
int Gecode::FlatZinc::FlatZincSpace::setVarCount [protected] |
Number of set variables.
Definition at line 259 of file flatzinc.hh.
int Gecode::FlatZinc::FlatZincSpace::_optVar [protected] |
Index of the integer variable to optimize.
Definition at line 262 of file flatzinc.hh.
Meth Gecode::FlatZinc::FlatZincSpace::_method [protected] |
Whether to solve as satisfaction or optimization problem.
Definition at line 265 of file flatzinc.hh.
Annotations on the solve item.
Definition at line 268 of file flatzinc.hh.
The integer variables.
Definition at line 282 of file flatzinc.hh.
std::vector<bool> Gecode::FlatZinc::FlatZincSpace::iv_introduced |
Indicates whether an integer variable is introduced by mzn2fzn.
Definition at line 284 of file flatzinc.hh.
Indicates whether an integer variable aliases a Boolean variable.
Definition at line 286 of file flatzinc.hh.
The Boolean variables.
Definition at line 288 of file flatzinc.hh.
std::vector<bool> Gecode::FlatZinc::FlatZincSpace::bv_introduced |
Indicates whether a Boolean variable is introduced by mzn2fzn.
Definition at line 290 of file flatzinc.hh.
The set variables.
Definition at line 293 of file flatzinc.hh.
std::vector<bool> Gecode::FlatZinc::FlatZincSpace::sv_introduced |
Indicates whether a set variable is introduced by mzn2fzn.
Definition at line 295 of file flatzinc.hh.
The documentation for this class was generated from the following files:
- gecode/flatzinc.hh (Revision: 10682)
- gecode/flatzinc/flatzinc.cpp (Revision: 10678)