Generated on Mon Aug 27 2012 17:15:59 for Gecode by doxygen 1.8.1.2
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, int seed, bool ignoreUnknown, std::ostream &err=std::cerr)
 Create branchers corresponding to the solve item annotations.
AST::ArraysolveAnnotations (void) const
 Return the solve item annotations.
virtual void constrain (const Space &s)
 Implement optimization.
virtual Gecode::Spacecopy (bool share)
 Copy function.
- Public Member Functions inherited from Gecode::Space
 Space (void)
 Default constructor.
virtual ~Space (void)
 Destructor.
 Space (bool share, Space &s)
 Constructor for cloning.
SpaceStatus status (StatusStatistics &stat=unused_status)
 Query space status.
const Choicechoice (void)
 Create new choice for current brancher.
const Choicechoice (Archive &e) const
 Create new choice from e.
Spaceclone (bool share=true, CloneStatistics &stat=unused_clone) const
 Clone space.
void commit (const Choice &c, unsigned int a, CommitStatistics &stat=unused_commit)
 Commit choice c for alternative a.
void notice (Actor &a, ActorProperty p)
 Notice actor property.
void ignore (Actor &a, ActorProperty p)
 Ignore actor property.
ExecStatus ES_SUBSUMED (Propagator &p)
 Propagator p is subsumed
ExecStatus ES_SUBSUMED_DISPOSED (Propagator &p, size_t s)
 Propagator p is subsumed
ExecStatus ES_FIX_PARTIAL (Propagator &p, const ModEventDelta &med)
 Propagator p has computed partial fixpoint
ExecStatus ES_NOFIX_PARTIAL (Propagator &p, const ModEventDelta &med)
 Propagator p has not computed partial fixpoint
template<class A >
ExecStatus ES_FIX_DISPOSE (Council< A > &c, A &a)
 Advisor a must be disposed
template<class A >
ExecStatus ES_NOFIX_DISPOSE (Council< A > &c, A &a)
 Advisor a must be disposed and its propagator must be run
template<class A >
ExecStatus ES_NOFIX_DISPOSE_FORCE (Council< A > &c, A &a)
 Advisor a must be disposed and its propagator must be forcefully rescheduled
void fail (void)
 Fail space.
bool failed (void) const
 Check whether space is failed.
bool stable (void) const
 Return if space is stable (at fixpoint or failed)
unsigned int propagators (void) const
 Return number of propagators.
unsigned int branchers (void) const
 Return number of branchers.
template<class T >
T * alloc (long unsigned int n)
 Allocate block of n objects of type T from space heap.
template<class T >
T * alloc (long int n)
 Allocate block of n objects of type T from space heap.
template<class T >
T * alloc (unsigned int n)
 Allocate block of n objects of type T from space heap.
template<class T >
T * alloc (int n)
 Allocate block of n objects of type T from space heap.
template<class T >
void free (T *b, long unsigned int n)
 Delete n objects allocated from space heap starting at b.
template<class T >
void free (T *b, long int n)
 Delete n objects allocated from space heap starting at b.
template<class T >
void free (T *b, unsigned int n)
 Delete n objects allocated from space heap starting at b.
template<class T >
void free (T *b, int n)
 Delete n objects allocated from space heap starting at b.
template<class T >
T * realloc (T *b, long unsigned int n, long unsigned int m)
 Reallocate block of n objects starting at b to m objects of type T from the space heap.
template<class T >
T * realloc (T *b, long int n, long int m)
 Reallocate block of n objects starting at b to m objects of type T from the space heap.
template<class T >
T * realloc (T *b, unsigned int n, unsigned int m)
 Reallocate block of n objects starting at b to m objects of type T from the space heap.
template<class T >
T * realloc (T *b, int n, int m)
 Reallocate block of n objects starting at b to m objects of type T from the space heap.
template<class T >
T ** realloc (T **b, long unsigned int n, long unsigned int m)
 Reallocate block of n pointers starting at b to m objects of type T* from the space heap.
template<class T >
T ** realloc (T **b, long int n, long int m)
 Reallocate block of n pointers starting at b to m objects of type T* from the space heap.
template<class T >
T ** realloc (T **b, unsigned int n, unsigned int m)
 Reallocate block of n pointers starting at b to m objects of type T* from the space heap.
template<class T >
T ** realloc (T **b, int n, int m)
 Reallocate block of n pointers starting at b to m objects of type T* from the space heap.
void * ralloc (size_t s)
 Allocate memory on space heap.
void rfree (void *p, size_t s)
 Free memory previously allocated with alloc (might be reused later)
void * rrealloc (void *b, size_t n, size_t m)
 Reallocate memory block starting at b from size n to size s.
template<size_t >
void * fl_alloc (void)
 Allocate from freelist-managed memory.
template<size_t >
void fl_dispose (FreeList *f, FreeList *l)
 Return freelist-managed memory to freelist.
size_t allocated (void) const
 Return how much heap memory is allocated.
void flush (void)
 Flush cached memory blocks and AFC information.
Home operator() (Propagator &p)
 Return a home for this space with the information that p is being rewritten.
template<class T >
T & construct (void)
 Construction routines.
template<class T , typename A1 >
T & construct (A1 const &a1)
 Constructs a single object of type T from space heap using a unary constructor.
template<class T , typename A1 , typename A2 >
T & construct (A1 const &a1, A2 const &a2)
 Constructs a single object of type T from space heap using a binary constructor.
template<class T , typename A1 , typename A2 , typename A3 >
T & construct (A1 const &a1, A2 const &a2, A3 const &a3)
 Constructs a single object of type T from space heap using a ternary constructor.
template<class T , typename A1 , typename A2 , typename A3 , typename A4 >
T & construct (A1 const &a1, A2 const &a2, A3 const &a3, A4 const &a4)
 Constructs a single object of type T from space heap using a quaternary constructor.
template<class T , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 >
T & construct (A1 const &a1, A2 const &a2, A3 const &a3, A4 const &a4, A5 const &a5)
 Constructs a single object of type T from space heap using a quinary constructor.

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.

Additional Inherited Members

- Static Public Member Functions inherited from Gecode::Space
static void * operator new (size_t)
 Allocate memory from heap for new space.
static void operator delete (void *)
 Free memory allocated from heap.

Detailed Description

A space that can be initialized with a FlatZinc model.

Definition at line 256 of file flatzinc.hh.

Member Enumeration Documentation

Enumerator:
SAT 
MIN 
MAX 

Definition at line 258 of file flatzinc.hh.

Constructor & Destructor Documentation

Gecode::FlatZinc::FlatZincSpace::FlatZincSpace ( bool  share,
FlatZincSpace f 
)
protected

Copy constructor.

Definition at line 218 of file flatzinc.cpp.

Gecode::FlatZinc::FlatZincSpace::FlatZincSpace ( void  )

Construct empty space.

Definition at line 232 of file flatzinc.cpp.

Gecode::FlatZinc::FlatZincSpace::~FlatZincSpace ( void  )

Destructor.

Definition at line 571 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 237 of file flatzinc.cpp.

void Gecode::FlatZinc::FlatZincSpace::newIntVar ( IntVarSpec vs)

Create new integer variable from specification.

Definition at line 258 of file flatzinc.cpp.

void Gecode::FlatZinc::FlatZincSpace::aliasBool2Int ( int  iv,
int  bv 
)

Link integer variable iv to Boolean variable bv.

Definition at line 275 of file flatzinc.cpp.

int Gecode::FlatZinc::FlatZincSpace::aliasBool2Int ( int  iv)

Return linked Boolean variable for integer variable iv.

Definition at line 279 of file flatzinc.cpp.

void Gecode::FlatZinc::FlatZincSpace::newBoolVar ( BoolVarSpec vs)

Create new Boolean variable from specification.

Definition at line 284 of file flatzinc.cpp.

void Gecode::FlatZinc::FlatZincSpace::newSetVar ( SetVarSpec vs)

Create new set variable from specification.

Definition at line 295 of file flatzinc.cpp.

void Gecode::FlatZinc::FlatZincSpace::postConstraint ( const ConExpr ce,
AST::Node annotation 
)

Post a constraint specified by ce.

Definition at line 340 of file flatzinc.cpp.

void Gecode::FlatZinc::FlatZincSpace::solve ( AST::Array annotation)

Post the solve item.

Definition at line 530 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 536 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 554 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 776 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 818 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 827 of file flatzinc.cpp.

FlatZincSpace::Meth Gecode::FlatZinc::FlatZincSpace::method ( void  ) const

Return whether to solve a satisfaction or optimization problem.

Definition at line 808 of file flatzinc.cpp.

int Gecode::FlatZinc::FlatZincSpace::optVar ( void  ) const

Return index of variable used for optimization.

Definition at line 813 of file flatzinc.cpp.

void Gecode::FlatZinc::FlatZincSpace::createBranchers ( AST::Node ann,
int  seed,
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.

The seed for random branchers is given by the seed parameter.

Definition at line 365 of file flatzinc.cpp.

AST::Array * Gecode::FlatZinc::FlatZincSpace::solveAnnotations ( void  ) const

Return the solve item annotations.

Definition at line 525 of file flatzinc.cpp.

void Gecode::FlatZinc::FlatZincSpace::constrain ( const Space s)
virtual

Implement optimization.

Reimplemented from Gecode::Space.

Definition at line 793 of file flatzinc.cpp.

Space * Gecode::FlatZinc::FlatZincSpace::copy ( bool  share)
virtual

Copy function.

Implements Gecode::Space.

Definition at line 803 of file flatzinc.cpp.

Member Data Documentation

int Gecode::FlatZinc::FlatZincSpace::intVarCount
protected

Number of integer variables.

Definition at line 265 of file flatzinc.hh.

int Gecode::FlatZinc::FlatZincSpace::boolVarCount
protected

Number of Boolean variables.

Definition at line 267 of file flatzinc.hh.

int Gecode::FlatZinc::FlatZincSpace::setVarCount
protected

Number of set variables.

Definition at line 269 of file flatzinc.hh.

int Gecode::FlatZinc::FlatZincSpace::_optVar
protected

Index of the integer variable to optimize.

Definition at line 272 of file flatzinc.hh.

Meth Gecode::FlatZinc::FlatZincSpace::_method
protected

Whether to solve as satisfaction or optimization problem.

Definition at line 275 of file flatzinc.hh.

AST::Array* Gecode::FlatZinc::FlatZincSpace::_solveAnnotations
protected

Annotations on the solve item.

Definition at line 278 of file flatzinc.hh.

Gecode::IntVarArray Gecode::FlatZinc::FlatZincSpace::iv

The integer variables.

Definition at line 292 of file flatzinc.hh.

std::vector<bool> Gecode::FlatZinc::FlatZincSpace::iv_introduced

Indicates whether an integer variable is introduced by mzn2fzn.

Definition at line 294 of file flatzinc.hh.

int* Gecode::FlatZinc::FlatZincSpace::iv_boolalias

Indicates whether an integer variable aliases a Boolean variable.

Definition at line 296 of file flatzinc.hh.

Gecode::BoolVarArray Gecode::FlatZinc::FlatZincSpace::bv

The Boolean variables.

Definition at line 298 of file flatzinc.hh.

std::vector<bool> Gecode::FlatZinc::FlatZincSpace::bv_introduced

Indicates whether a Boolean variable is introduced by mzn2fzn.

Definition at line 300 of file flatzinc.hh.

Gecode::SetVarArray Gecode::FlatZinc::FlatZincSpace::sv

The set variables.

Definition at line 303 of file flatzinc.hh.

std::vector<bool> Gecode::FlatZinc::FlatZincSpace::sv_introduced

Indicates whether a set variable is introduced by mzn2fzn.

Definition at line 305 of file flatzinc.hh.


The documentation for this class was generated from the following files: