/* -*- C++ -*- * * This file is a part of LEMON, a generic C++ optimization library * * Copyright (C) 2003-2006 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For * precise terms see the accompanying LICENSE file. * * This software is provided "AS IS" with no warranty of any kind, * express or implied, and with no claim as to its suitability for any * purpose. * */ #ifndef LEMON_BENCH_TEST_H #define LEMON_BENCH_TEST_H #include #include #include #include ///A primitive primtest ///\bug 2 is not a prime according to this function! /// ///\bug This function should go out of header file. I'm making it /// inline for now. inline bool isPrim(int n) { if(n%2) { for(int k=3;n/k>=k;k+=2) if(!(n%k)) return false; return true; } return false; } ///Finds the smallest prime not less then \c n. ///\bug This function should go out of header file. I'm making it /// inline for now. inline int nextPrim(int n) { for(n+=!(n%2);!isPrim(n);n+=2) ; return n; } /// Class to generate consecutive primes class Primes { std::vector primes; int n; bool isPrime(int m) { for(int i=0;m void addHyperCube(Graph &G,int dim,std::vector &nodes) { GRAPH_TYPEDEFS(typename Graph); std::vector bits(dim+1); bits[0]=1; for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1]; for(int i=0;i void addBiDirHyperCube(Graph &G,int dim,std::vector&nodes) { GRAPH_TYPEDEFS(typename Graph); std::vector bits(dim+1); bits[0]=1; for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1]; for(int i=0;i