|
ADS
Algorithms and Data Structures
|
The polynomial reductions of chapter 18: a function \( f \) from the inputs of \( A \) to the inputs of \( B \), computable in polynomial time, such that \( x \) is a YES of \( A \) if and only if \( f( x ) \) is a YES of \( B \); then \( A \) is no harder than \( B \) (\( A \propto B \)). More...
#include "ADS/Contract.h"#include "ADS/complexity/Domino.h"#include "ADS/complexity/Problems.h"#include "ADS/geometry/ConvexHull.h"#include <array>#include <cstddef>#include <limits>#include <numeric>#include <tuple>#include <utility>#include <vector>#include "ADS/complexity/impl/Reductions.tpp"Go to the source code of this file.
Namespaces | |
| namespace | ADS |
Functions | |
| int | ADS::tileVar (int h, int i, int j, int n) |
| the place \( ( h n + i ) n + j \) of the variable or node of the tile \( h \) in the square \( ( i , j ) \) | |
| std::pair< Adjacency, int > | ADS::dominoToClique (const std::vector< Tile > &D, int n) |
| BOUNDED TILING to CLIQUE: the graph on the \( m n^2 \) places of tileVar(), the ones of \( ( 0 , 0 ) \) but \( u_{000} \) isolated, and \( k \). | |
| Cnf | ADS::dominoToSat (const std::vector< Tile > &D, int n) |
| BOUNDED TILING to SATISFIABILITY, on the \( m n^2 \) variables of tileVar(). | |
| std::pair< std::vector< std::vector< long > >, std::vector< long > > | ADS::dominoToLp01 (const std::vector< Tile > &D, int n) |
| BOUNDED TILING to 0-1 INTEGER PROGRAMMING: \( A x \le b \) on the \( m n^2 \) variables of tileVar(), each equation as two inequalities. | |
| Adjacency | ADS::complement (const Adjacency &G) |
| the complement graph: CLIQUE of size \( k \) to INDEPENDENT SET of size \( k \) | |
| std::vector< std::vector< long > > | ADS::hamiltonToTsp (const Adjacency &G) |
| HAMILTONIAN CIRCUIT to TRAVELING SALESMAN: the distances, \( k = n \). | |
| long | ADS::halfSum (const std::vector< long > &A) |
| half the sum, or \( -1 \) if the sum is odd (then no partition: the bound \( -1 \) has no YES in any of the three problems) | |
| Adjacency | ADS::cycleToPath (const Adjacency &G) |
| DIRECTED HAMILTONIAN CIRCUIT to DIRECTED HAMILTONIAN PATH from \( n \) to 0: the node 0 split, a new node \( n \) with the edges out of 0; the loops of \( G \) dropped, as the problems of Problems.h ignore them. | |
| Adjacency | ADS::cycleToChain (const Adjacency &G) |
| DIRECTED HAMILTONIAN CIRCUIT to HAMILTONIAN PATH: the path of cycleToPath(), each node \( v \) a chain \( v_{in} - v_{mid} - v_{out} \), each edge \( ( u , v ) \) an edge \( [ u_{out} , v_{in} ] \), and pendant nodes at the start and at the end. | |
| std::vector< Point > | ADS::sortToHull (const std::vector< long > &a) |
| SORTING to CONVEX HULL: the points \( ( a , a^2 ) \). | |
The polynomial reductions of chapter 18: a function \( f \) from the inputs of \( A \) to the inputs of \( B \), computable in polynomial time, such that \( x \) is a YES of \( A \) if and only if \( f( x ) \) is a YES of \( B \); then \( A \) is no harder than \( B \) (\( A \propto B \)).
The contracts [see Contract.h]: each reduction checks that its input is an instance of the problem reduced (a square or unoriented graph, a nonempty set of tiles, numbers not negative) and that its output has the shape of an instance of the target problem. The operations are defined in Reductions.tpp.