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

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

#include "base/commandlineflags.h"
#include "base/integral_types.h"
#include "base/logging.h"
#include "base/stringprintf.h"
#include "constraint_solver/constraint_solver.h"

Go to the source code of this file.

Namespaces

namespace  operations_research

Functions

 DEFINE_int32 (size, 0,"Size of the magic square.")
 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
 DEFINE_bool (impact, false,"Use impact search.")
 DEFINE_int32 (restart,-1,"Parameter for constant restart monitor.")
 DEFINE_bool (luby, false,"Use luby restart monitor instead of constant restart monitor.")
 DEFINE_bool (run_all_heuristics, false,"Run all heuristics.")
 DEFINE_int32 (heuristics_period, 200,"Frequency to run all heuristics.")
 DEFINE_int32 (choose_var_strategy, 0,"Selection strategy for variable: 0 = max sum impact, ""1 = max average impact, ""2 = max individual impact.")
 DEFINE_bool (select_max_impact_value, false,"Select the value with max impact instead of min impact.")
 DEFINE_double (restart_log_size,-1.0,"Threshold for automatic restarting the search in default"" phase.")
 DEFINE_bool (verbose_impact, false,"Verbose output of impact search.")
 DEFINE_bool (use_nogoods, false,"Use no goods in automatic restart.")
void operations_research::MagicSquare (int grid_size)
int main (int argc, char **argv)
 namespace operations_research


Function Documentation

DEFINE_bool ( use_nogoods  ,
false  ,
"Use no goods in automatic restart."   
)

DEFINE_bool ( verbose_impact  ,
false  ,
"Verbose output of impact search."   
)

DEFINE_bool ( select_max_impact_value  ,
false  ,
"Select the value with max impact instead of min impact."   
)

DEFINE_bool ( run_all_heuristics  ,
false  ,
"Run all heuristics."   
)

DEFINE_bool ( luby  ,
false  ,
"Use luby restart monitor instead of constant restart monitor."   
)

DEFINE_bool ( impact  ,
false  ,
"Use impact search."   
)

DEFINE_double ( restart_log_size  ,
-1.  0,
"Threshold for automatic restarting the search in default"" phase."   
)

DEFINE_int32 ( choose_var_strategy  ,
,
"Selection strategy for variable:   0 = max sum impact,
""  1 = max average impact 
)

DEFINE_int32 ( heuristics_period  ,
200  ,
"Frequency to run all heuristics."   
)

DEFINE_int32 ( restart  ,
1,
"Parameter for constant restart monitor."   
)

DEFINE_int32 ( size  ,
,
"Size of the magic square."   
)

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.

Magic square problem

Solves the problem where all numbers in an nxn array have to be different while the sums on diagonals, rows, and columns have to be the same. The problem is trivial for odd orders, but not for even orders. We do not handle odd orders with the trivial method here.

int main ( int  argc,
char **  argv 
)

namespace operations_research

Definition at line 153 of file magic_square.cc.