ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Reductions.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*--------------------------- File Reductions.h ----------------------------*/
3/*--------------------------------------------------------------------------*/
58/*--------------------------------------------------------------------------*/
59/*----------------------------- DEFINITIONS --------------------------------*/
60/*--------------------------------------------------------------------------*/
61
62#ifndef __ADS_Reductions
63 #define __ADS_Reductions
64/* self-identification: #endif constant */
65
66/*--------------------------------------------------------------------------*/
67/*------------------------------ INCLUDES ----------------------------------*/
68/*--------------------------------------------------------------------------*/
69
70#include "ADS/Contract.h"
74
75#include <array>
76#include <cstddef>
77#include <limits>
78#include <numeric>
79#include <tuple>
80#include <utility>
81#include <vector>
82
83/*--------------------------------------------------------------------------*/
84/*--------------------------- NAMESPACE ------------------------------------*/
85/*--------------------------------------------------------------------------*/
86
87namespace ADS
88{
89
94inline int tileVar( int h , int i , int j , int n );
95
122inline std::pair< Adjacency , int >
123dominoToClique( const std::vector< Tile > & D , int n );
124
147inline Cnf dominoToSat( const std::vector< Tile > & D , int n );
148
173inline std::pair< std::vector< std::vector< long > > , std::vector< long > >
174dominoToLp01( const std::vector< Tile > & D , int n );
175
190inline Adjacency complement( const Adjacency & G );
191
207inline std::vector< std::vector< long > > hamiltonToTsp( const Adjacency & G );
208
225inline long halfSum( const std::vector< long > & A );
226
247inline Adjacency cycleToPath( const Adjacency & G );
248
276inline Adjacency cycleToChain( const Adjacency & G );
277
292inline std::vector< Point > sortToHull( const std::vector< long > & a );
293
294/*--------------------------------------------------------------------------*/
295
296} // end( namespace ADS )
297
298/*--------------------------------------------------------------------------*/
299/*-------------------------- IMPLEMENTATION --------------------------------*/
300/*--------------------------------------------------------------------------*/
301
302#include "ADS/complexity/impl/Reductions.tpp"
303
304/*--------------------------------------------------------------------------*/
305
306#endif /* Reductions.h included */
307
308/*--------------------------------------------------------------------------*/
309/*------------------------- End File Reductions.h --------------------------*/
310/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The convex hull of a set of points of the plane (section 16.1), the smallest convex polygon that co...
The square tiling (BOUNDED TILING, the DOMINO LIMITATO of the book) of chapter 18: squares to cover ...
The problems in NP of chapter 18, each with its polynomial certificate, which checks a proposed solut...
std::pair< std::vector< std::vector< long > >, std::vector< long > > dominoToLp01(const std::vector< Tile > &D, int n)
BOUNDED TILING to 0-1 INTEGER PROGRAMMING: on the variables of tileVar(), each equation as two ineq...
Adjacency cycleToPath(const Adjacency &G)
DIRECTED HAMILTONIAN CIRCUIT to DIRECTED HAMILTONIAN PATH from to 0: the node 0 split,...
long halfSum(const std::vector< long > &A)
half the sum, or if the sum is odd (then no partition: the bound has no YES in any of the three pro...
Cnf dominoToSat(const std::vector< Tile > &D, int n)
BOUNDED TILING to SATISFIABILITY, on the variables of tileVar().
Adjacency complement(const Adjacency &G)
the complement graph: CLIQUE of size to INDEPENDENT SET of size
std::vector< std::vector< long > > hamiltonToTsp(const Adjacency &G)
HAMILTONIAN CIRCUIT to TRAVELING SALESMAN: the distances, .
std::vector< Point > sortToHull(const std::vector< long > &a)
SORTING to CONVEX HULL: the points .
std::pair< Adjacency, int > dominoToClique(const std::vector< Tile > &D, int n)
BOUNDED TILING to CLIQUE: the graph on the places of tileVar(), the ones of but isolated,...
Adjacency cycleToChain(const Adjacency &G)
DIRECTED HAMILTONIAN CIRCUIT to HAMILTONIAN PATH: the path of cycleToPath(), each node a chain ,...
int tileVar(int h, int i, int j, int n)
the place of the variable or node of the tile in the square
Definition ADT.h:96
std::vector< Clause > Cnf
a formula
Definition Problems.h:85
std::vector< std::vector< bool > > Adjacency
an adjacency
Definition Problems.h:83