59 #define __ADS_Problems
83using Adjacency = std::vector< std::vector< bool > >;
85using Cnf = std::vector< Clause >;
86using Nodes = std::vector< int >;
111template<
class Ok ,
class Done >
112bool chooseK(
int n ,
int k , Ok && ok , Done && done );
265std::optional< Nodes >
tsp(
const std::vector< std::vector< T > > & D , T k );
272inline std::optional< Nodes > hamilton(
const Adjacency & G ,
273 const Nodes & starts ,
bool cycle ,
276inline Nodes all(
int n );
425inline std::optional< std::vector< std::pair< int , int > > >
486inline std::optional< std::vector< int > >
487lp01(
const std::vector< std::vector< long > > & A ,
488 const std::vector< long > & b ,
int n );
531inline std::optional< Nodes >
partition(
const std::vector< long > & A );
556 const std::vector< long > & v ,
585inline std::optional< std::vector< int > >
611inline std::optional< Nodes >
612exactCover3(
const std::vector< std::array< int , 3 > > & Y ,
int m );
630inline std::optional< Nodes >
654inline std::optional< std::vector< long > >
655bribes( std::vector< long > M ,
const std::vector< bool > & ps );
665#include "ADS/complexity/impl/Problems.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
std::optional< std::vector< int > > lp01(const std::vector< std::vector< long > > &A, const std::vector< long > &b, int n)
a 0-1 vector with , by enumeration, or nothing
std::optional< Nodes > independentSet(const Adjacency &G, int k)
nodes no two adjacent, or nothing
std::optional< Nodes > tsp(const std::vector< std::vector< T > > &D, T k)
a tour of length at most from city 0, the partial tours longer than pruned, or nothing (the enTsp()...
std::optional< std::vector< int > > multiprocessorScheduling(const std::vector< long > &t, int m, long d)
the processor of each program, so that processors run them all within time , or nothing (also if ,...
bool satCertificate(const Cnf &F, const std::vector< bool > &x)
whether satisfies every clause of
std::optional< std::vector< int > > coloring(const Adjacency &G, int k)
a coloring of the nodes with at most colors, adjacent nodes of different colors, by backtrack,...
std::optional< Nodes > vertexCover(const Adjacency &G, int k)
at most nodes that touch every edge, or nothing
std::optional< Nodes > hamiltonianPath(const Adjacency &G, int r=-1, int t=-1)
an oriented path through every node once, from and to if given
std::optional< Nodes > hamiltonianCircuit(const Adjacency &G)
an unoriented circuit through every node once ( ), or nothing
std::optional< Nodes > longestPath(const Adjacency &G, int r, int t, int k)
a simple path from to of at least edges, by backtrack
std::optional< Nodes > hamiltonianChain(const Adjacency &G)
an unoriented chain through every node once
bool tspCertificate(const std::vector< std::vector< T > > &D, T k, const Nodes &P)
whether the tour , a permutation, is at most long; the empty tour of no city is 0 long (the certific...
std::optional< Nodes > knapsackDecision(const std::vector< long > &p, const std::vector< long > &v, long C, long k)
objects of volume at most and profit at least (the enZaino() of the book)
std::optional< Nodes > partition(const std::vector< long > &A)
the places of a half of of half the sum, or nothing
bool cliqueCertificate(const Adjacency &G, const Nodes &S, int k)
whether , of distinct nodes, has of them or more, all adjacent (the certificatoCricca() of the book)
int longestPathDag(const Adjacency &G, int r, int t)
the most edges of a path from to in an acyclic oriented graph, if is not reachable; by the topol...
std::optional< Nodes > threeDimensionalMatching(const std::vector< std::array< int, 3 > > &M, int q)
a matching of triples of with distinct , and , the three sets being , or nothing
std::optional< Nodes > subsetSumExists(const std::vector< long > &A, long k)
a set of the places of of sum , by backtrack, or nothing
std::optional< Nodes > clique(const Adjacency &G, int k)
nodes all adjacent, or nothing (the enCricca() of the book)
std::optional< std::vector< std::pair< int, int > > > boundedSpanningTree(const Adjacency &G, int k)
a spanning tree of the unoriented graph with at most edges at each node, as edges,...
std::optional< std::vector< bool > > satisfiable(const Cnf &F, int n)
an assignment of the variables that satisfies , by backtrack with a clause checked as soon as its va...
std::optional< Nodes > bisection(const Adjacency &G, int k)
a partition of the nodes in two halves cut by at most edges, or nothing; the half of node 0
std::optional< Nodes > exactCover3(const std::vector< std::array< int, 3 > > &Y, int m)
sets of three of that partition it, by places, the ones that meet those chosen pruned,...
std::optional< std::vector< long > > bribes(std::vector< long > M, const std::vector< bool > &ps)
the bribes to the politicians, if the -th is of the party PS, so that the PS gets twice the party...
std::optional< Nodes > hamiltonianCycle(const Adjacency &G)
an oriented cycle through every node once ( ), or nothing
std::vector< int > Clause
some literals
Definition Problems.h:84
std::vector< int > Nodes
a set, a path
Definition Problems.h:86
std::vector< Clause > Cnf
a formula
Definition Problems.h:85
std::vector< std::vector< bool > > Adjacency
an adjacency
Definition Problems.h:83