// Copright (C) 1999-2006, Bernd Gaertner // $Revision: 1.5 $ // $Date: 2007/06/19 15:35:20 $ // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, // or download the License terms from prep.ai.mit.edu/pub/gnu/COPYING-2.0. // // Contact: // -------- // Bernd Gaertner // Institute of Theoretical Computer Science // ETH Zuerich // CAB G32.2 // CH-8092 Zuerich, Switzerland // http://www.inf.ethz.ch/personal/gaertner #include #include #include #include "Miniball.h" int main (int argc, char* argv[]) { using std::cout; using std::endl; if (argc != 2) { cout << "Usage: miniball_example " << endl; exit(1); } else srand (atoi(argv[1])); const int d = 5; const int n = 100000; Miniball mb; // generate random points and check them in // ---------------------------------------- Point p; for (int i=0; i::Cit it; for (it=mb.support_points_begin(); it!=mb.support_points_end(); ++it) cout << *it << endl; cout << endl; // output accuracy // --------------- double slack; cout << "Relative accuracy: " << mb.accuracy (slack) << endl; cout << "Optimality slack: " << slack << endl; // check validity (even if this fails, the ball may be acceptable, // see the interface of class Miniball) // ------------------------------------ cout << "Validity: " << (mb.is_valid() ? "ok" : "possibly invalid") << endl; return 0; }