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

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

#include <time.h>
#include <set>
#include <utility>
#include "base/callback.h"
#include "base/commandlineflags.h"
#include "base/integral_types.h"
#include "base/logging.h"
#include "base/stringprintf.h"
#include "constraint_solver/constraint_solver.h"
#include "constraint_solver/constraint_solveri.h"
#include "base/random.h"

Go to the source code of this file.

Namespaces

namespace  operations_research

Classes

class  operations_research::OrderedLNS
 Cycles all possible permutations. More...
class  operations_research::RandomLNS
 RandomLNS is used for the local search and frees the number of elements specified in 'free_elements' randomly. More...
class  operations_research::Evaluator

Functions

 DEFINE_int32 (minsize, 0,"Minimum degree of Costas matrix.")
 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
 DEFINE_int32 (maxsize, 0,"Maximum degree of Costas matrix.")
 DEFINE_int32 (freevar, 5,"Number of free variables.")
 DEFINE_int32 (freeorderedvar, 4,"Number of variables in ordered subset.")
 DEFINE_int32 (sublimit, 20,"Number of attempts per subtree.")
 DEFINE_int32 (timelimit, 120000,"Time limit for local search.")
 DEFINE_bool (soft_constraints, false,"Use soft constraints.")
 DEFINE_string (export_profile,"","filename to save the profile overview")
void operations_research::CheckConstraintViolators (const std::vector< int64 > &vars, std::vector< int > *const violators)
 Checks that all pairwise distances are unique and returns all violators.
bool operations_research::CheckCostas (const std::vector< int64 > &vars)
 Check that all pairwise differences are unique.
void operations_research::CostasSoft (const int dim)
 Computes a Costas Array using soft constraints.
void operations_research::CostasHard (const int dim)
 Computes a Costas Array.
int main (int argc, char **argv)
 namespace operations_research


Function Documentation

DEFINE_bool ( soft_constraints  ,
false  ,
"Use soft constraints."   
)

DEFINE_int32 ( timelimit  ,
120000  ,
"Time limit for local search."   
)

DEFINE_int32 ( sublimit  ,
20  ,
"Number of attempts per subtree."   
)

DEFINE_int32 ( freeorderedvar  ,
,
"Number of variables in ordered subset."   
)

DEFINE_int32 ( freevar  ,
,
"Number of free variables."   
)

DEFINE_int32 ( maxsize  ,
,
"Maximum degree of Costas matrix."   
)

DEFINE_int32 ( minsize  ,
,
"Minimum degree of Costas matrix."   
)

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.

Costas Array Problem

Finds an NxN matrix of 0s and 1s, with only one 1 per row, and one 1 per column, such that all displacement vectors between each pair of 1s are distinct.

This example contains two separate implementations. CostasHard() uses hard constraints, whereas CostasSoft() uses a minimizer to minimize the number of duplicates.

DEFINE_string ( export_profile  ,
""  ,
"filename to save the profile overview"   
)

int main ( int  argc,
char **  argv 
)

namespace operations_research

Definition at line 441 of file costas_array.cc.