Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set
// doxy/ or-tools/ examples/ cpp/

or-tools/examples/cpp/nqueens.cc File Reference

#include <cstdio>
#include <map>
#include "base/commandlineflags.h"
#include "base/integral_types.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "base/stringprintf.h"
#include "base/map-util.h"
#include "constraint_solver/constraint_solveri.h"

Go to the source code of this file.

Namespaces

namespace  operations_research

Classes

class  operations_research::NQueenSymmetry
class  operations_research::SX
 Symmetry vertical axis. More...
class  operations_research::SY
 Symmetry horizontal axis. More...
class  operations_research::SD1
 Symmetry first diagonal axis. More...
class  operations_research::SD2
 Symmetry second diagonal axis. More...
class  operations_research::R90
 Rotate 1/4 turn. More...
class  operations_research::R180
 Rotate 1/2 turn. More...
class  operations_research::R270
 Rotate 3/4 turn. More...

Functions

 DEFINE_bool (print, false,"If true, print one of the solution.")
 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
 DEFINE_bool (print_all, false,"If true, print all the solutions.")
 DEFINE_int32 (nb_loops, 1,"Number of solving loops to perform, for performance timing.")
 DEFINE_int32 (size, 0,"Size of the problem. If equal to 0, will test several increasing sizes.")
 DEFINE_bool (use_symmetry, false,"Use Symmetry Breaking methods")
 DECLARE_BOOL (cp_no_solve)
void operations_research::CheckNumberOfSolutions (int size, int num_solutions)
void operations_research::NQueens (int size)
int main (int argc, char **argv)
 namespace operations_research

Variables

static const int kNumSolutions []
static const int kKnownSolutions = 15
static const int kNumUniqueSolutions []
static const int kKnownUniqueSolutions = 19


Function Documentation

DECLARE_BOOL ( cp_no_solve   ) 

DEFINE_bool ( use_symmetry  ,
false  ,
"Use Symmetry Breaking methods"   
)

DEFINE_bool ( print_all  ,
false  ,
"If   true,
print all the solutions."   
)

DEFINE_bool ( print  ,
false  ,
"If   true,
print one of the solution."   
)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

N-queens problem

unique solutions: http://www.research.att.com/~njas/sequences/A000170 distinct solutions: http://www.research.att.com/~njas/sequences/A002562

DEFINE_int32 ( size  ,
,
"Size of the problem. If equal to   0,
will test several increasing sizes."   
)

DEFINE_int32 ( nb_loops  ,
,
"Number of solving loops to   perform,
for performance timing."   
)

int main ( int  argc,
char **  argv 
)

namespace operations_research

Definition at line 265 of file nqueens.cc.


Variable Documentation

const int kKnownSolutions = 15 [static]

Definition at line 44 of file nqueens.cc.

const int kKnownUniqueSolutions = 19 [static]

Definition at line 50 of file nqueens.cc.

const int kNumSolutions[] [static]

Initial value:

 {
  1, 0, 0, 2, 10, 4, 40, 92, 352, 724,
  2680, 14200, 73712, 365596, 2279184
}

Definition at line 40 of file nqueens.cc.

const int kNumUniqueSolutions[] [static]

Initial value:

 {
  1, 0, 0, 1, 2, 1, 6, 12, 46, 92, 341, 1787, 9233, 45752,
  285053, 1846955, 11977939, 83263591, 621012754
}

Definition at line 46 of file nqueens.cc.