38 namespace Gecode {
namespace Gist {
47 std::ostringstream result;
48 dynamic_cast<const S&
>(s0).
compare(s1,result);
49 if (result.str() !=
"") {
52 getStream() << result.str() << std::endl;
53 addHtml(
"</pre><hr />");
73 std::ostringstream ret;
74 ret << x_n <<
"=" << x <<
" -> " << y;
82 std::ostringstream ret;
83 ret << x_n <<
"=" << x <<
" -> " << y;
88 #ifdef GECODE_HAS_SET_VARS
97 std::ostringstream ret;
98 ret << x_n <<
"=" << x <<
" -> " << y;
104 #ifdef GECODE_HAS_FLOAT_VARS
108 std::ostringstream ret;
109 ret << x_n <<
"=" << x <<
" -> " << y;
120 return "Error: array size mismatch";
121 std::ostringstream ret;
123 for (
int i=0;
i<x.
size();
i++) {
124 std::ostringstream xni;
125 xni << x_n <<
"[" <<
i <<
"]";
126 std::string cmp =
compare(xni.str(),x[
i],y[
i]);
148 dynamic_cast<const S&
>(node).
print(getStream());
150 addHtml(
"</pre><hr />");
170 _solution(
heap,1), n_solution(0),
171 _move(
heap,1), n_move(0), _compare(
heap,1), n_compare(0) {}
175 _click[
static_cast<int>(n_click++)] = i;
179 _solution[
static_cast<int>(n_solution++)] = i;
183 _move[
static_cast<int>(n_move++)] = i;
187 _compare[
static_cast<int>(n_compare++)] = c;
191 return (i < n_click) ? _click[
i] : NULL;
195 return (i < n_solution) ? _solution[
i] : NULL;
199 return (i < n_move) ? _move[
i] : NULL;
203 return (i < n_compare) ? _compare[
i] : NULL;
208 return explore(root,
false, opt);
void click(Inspector *i)
Add inspector that reacts on node double clicks.
unsigned int cardMax(void) const
Return cardinality maximum.
int size(void) const
Return size of array (number of elements)
Abstract base class for comparators.
virtual std::string name(void)
Name of the inspector.
bool equal(I &i, J &j)
Check whether range iterators i and j are equal.
virtual void inspect(const Space &node)
Use the print method of the template class S to print a space.
Abstract base class for inspectors.
FloatNum max(void) const
Return maximum of domain.
virtual void finalize(void)
Clean up when Gist exits.
Range iterator for integer variables
unsigned int cardMin(void) const
Return cardinality minimum.
void solution(Inspector *i)
Add inspector that reacts on each new solution that is found.
Heap heap
The single global heap.
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i(4, 1, 2, 3, 4)
int dfs(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for root.
void finalize(void)
Clean up when Gist exits.
Print(const std::string &name)
Constructor.
Iterator for the greatest lower bound ranges of a set variable.
int max(void) const
Return maximum of domain.
virtual void compare(const Space &s0, const Space &s1)=0
Call-back function.
Options(void)
Initialize with default values.
Iterator for the least upper bound ranges of a set variable.
Boolean integer variables.
void print(std::basic_ostream< Char, Traits > &s, bool assigned, IL &lb, IU &ub, unsigned int cardMin, unsigned int cardMax)
Print set view.
VarComparator(std::string name)
Constructor.
Node * x
Pointer to corresponding Boolean expression node.
virtual void finalize(void)
Finalize when Gist exits.
FloatNum min(void) const
Return minimum of domain.
virtual void compare(const Space &s0, const Space &s1)
Compare s0 to s1.
int bab(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for branch-and-bound search of root.
An window for simple text output.
virtual std::string name(void)
Return name.
CompareStatus compare(I &i, J &j)
Check whether range iterator i is a subset of j, or whether they are disjoint.
int explore(Space *root, bool bab, const Options &opt)
Create a new stand-alone Gist for root using bab.
Gecode toplevel namespace
Argument array for variables.
int min(void) const
Return minimum of domain.
void compare(Comparator *c)
Add comparator.
virtual std::string name(void)
Return name.
void move(Inspector *i)
Add inspector that reacts on each move of the cursor.