Generated on Sat Feb 7 2015 02:01:18 for Gecode by doxygen 1.8.9.1
gist.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  *
6  * Copyright:
7  * Guido Tack, 2006
8  *
9  * Last modified:
10  * $Date: 2011-08-25 10:43:31 +0200 (Thu, 25 Aug 2011) $ by $Author: tack $
11  * $Revision: 12352 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #include <QtGui>
39 
40 #include <gecode/gist.hh>
44 
45 namespace Gecode { namespace Gist {
46 
47  std::string
48  Inspector::name(void) { return "Inspector"; }
49 
50  void
52 
54 
55  std::string
56  Comparator::name(void) { return "Comparator"; }
57 
58  void
60 
62 
63  TextOutput::TextOutput(const std::string& name)
64  : t(NULL), n(name) {}
65 
66  void
68  delete t;
69  t = NULL;
70  }
71 
73  delete t;
74  }
75 
76  std::string
77  TextOutput::name(void) { return n; }
78 
79  void
81  if (t == NULL) {
82  t = new TextOutputI(n);
83  }
84  t->setVisible(true);
85  }
86 
87  std::ostream&
89  return t->getStream();
90  }
91 
92  void
94  t->flush();
95  }
96 
97  void
98  TextOutput::addHtml(const char* s) {
99  t->insertHtml(s);
100  }
101 
102  const Options Options::def;
103 
104  int
105  explore(Space* root, bool bab, const Options& opt) {
106  char argv0='\0'; char* argv1=&argv0;
107  int argc=0;
108  QApplication app(argc, &argv1);
109  GistMainWindow mw(root, bab, opt);
110  return app.exec();
111  }
112 
113  void
114  stopBranch(Space& home) {
115  StopBrancher::post(home);
116  }
117 
118 }}
119 
120 // STATISTICS: gist-any
NodeType t
Type of node.
Definition: bool-expr.cpp:234
std::ostream & getStream(void)
Get the stream that is used to output text.
Definition: gist.cpp:88
virtual ~Inspector(void)
Destructor.
Definition: gist.cpp:53
TextOutput(const std::string &name)
Constructor.
Definition: gist.cpp:63
virtual void finalize(void)
Clean up when Gist exits.
Definition: gist.cpp:51
void addHtml(const char *s)
Add html text s to the output.
Definition: gist.cpp:98
void stopBranch(Space &home)
A branching that stops exploration.
Definition: gist.cpp:114
virtual std::string name(void)
Name of the inspector.
Definition: gist.cpp:77
void flush(void)
Flush stream.
Definition: gist.cpp:93
Computation spaces.
Definition: core.hpp:1362
void flush(void)
Flush output.
Definition: textoutput.cpp:152
virtual std::string name(void)
Name of the comparator.
Definition: gist.cpp:56
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
Options opt
The options.
Definition: test.cpp:101
Main window for stand-alone Gist.
Definition: mainwindow.hh:58
void finalize(void)
Clean up when Gist exits.
Definition: gist.cpp:67
virtual std::string name(void)
Name of the inspector.
Definition: gist.cpp:48
void init(void)
Initialize the implementation object.
Definition: gist.cpp:80
virtual ~TextOutput(void)
Destructor.
Definition: gist.cpp:72
virtual void finalize(void)
Clean up when Gist exits.
Definition: gist.cpp:59
int bab(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for branch-and-bound search of root.
Definition: gist.hpp:212
std::ostream & getStream(void)
Return stream that prints to the text display.
Definition: textoutput.cpp:147
static const Options def
Default options.
Definition: gist.hh:273
virtual ~Comparator(void)
Destructor.
Definition: gist.cpp:61
int explore(Space *root, bool bab, const Options &opt)
Create a new stand-alone Gist for root using bab.
Definition: gist.cpp:105
Gecode toplevel namespace
void insertHtml(const QString &s)
Add html string s to the output.
Definition: textoutput.cpp:157
Window with associated ostream, used for inspecting Gist nodes.
Definition: textoutput.hh:46
Options for Gist
Definition: gist.hh:238
static void post(Home home)
Post brancher.