A set of benchmarks to compare a new prototype MiniZinc implementation
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
3/*
4 * Main authors:
5 * Guido Tack <guido.tack@monash.edu>
6 */
7
8/* This Source Code Form is subject to the terms of the Mozilla Public
9 * License, v. 2.0. If a copy of the MPL was not distributed with this
10 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
11
12#ifndef __MINIZINC_STATISTICS_HH__
13#define __MINIZINC_STATISTICS_HH__
14#include <iterator>
15
16namespace MiniZinc {
17
18class Statistics {
19protected:
20 // time in milliseconds
21 unsigned long long _time;
22 // search nodes
23 unsigned long long _nodes;
24 // failures/ backtracks
25 unsigned long long _failures;
26 // current objective value
27 double _objective;
28
29public:
30 Statistics() : _time(0), _nodes(0), _failures(0) {}
31
32 virtual void print(std::ostream& os);
33
34 void time(unsigned long long t);
35 void nodes(unsigned long long n);
36 void failures(unsigned long long f);
37 void objective(double o);
38
39 unsigned long long time();
40 unsigned long long nodes();
41 unsigned long long failures();
42 double objective();
43
44 Statistics& operator+=(Statistics& s);
45
46 virtual void cleanup() { _time = _nodes = _failures = 0; }
47};
48} // namespace MiniZinc
49
50#endif