php.cpp File Reference
#include <vector>
#include <string>
#include <fstream>
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include "../cnflib/formula.h"
#include "../cnflib/clause.h"
#include "../cnflib/variableset.h"
#include "../graphlib/bipartitegraph.h"
#include "../graphlib/vertex.h"
+ Include dependency graph for php.cpp:

Go to the source code of this file.

Functions

unsigned int string2uint (std::string str)
 Transforms a C++ string into an unsigned int using stream buffers.
void pigeonAxiom (unsigned int i, BipartiteGraph G, Formula *form, VariableSet *vars)
 Adds the clause corresponding to the pigeon axiom for the ith pigeon.
void holeAxiom (unsigned int j, BipartiteGraph G, Formula *form, VariableSet *vars)
 Adds the clauses corresponding to the hole axiom for hole number j.
void pigeonHolePrinciple (BipartiteGraph G)
 Prints the dimacs formatted CNF formula corresponding to the pigeon hole principle on graph G to the standard output.
void randomNeighbours (unsigned int leftOrder, unsigned int n)
 Prints on standard output the graph file corresponding to a graph with n+1 left vertives, n right vertices and such that all the left vertices have leftOrder neighbours picked uniformly randomly among the right ones.
int main (int argc, char **argv)
 Main method to manipulate PHP formulas.

Detailed Description

Author:
Léo Perrin
Date:
2011/11/23

Definition in file php.cpp.


Function Documentation

void holeAxiom ( unsigned int  j,
BipartiteGraph  G,
Formula *  form,
VariableSet *  vars 
)

Adds the clauses corresponding to the hole axiom for hole number j.

Parameters:
jThe hole to consider.
GThe BipartiteGraph instance from which to build the formula.
formA pointer to the Formula instance we will append the clause to.
varsThe variable set to use.

Definition at line 76 of file php.cpp.

int main ( int  argc,
char **  argv 
)

Main method to manipulate PHP formulas.

If not given any argument, parses stdin to read a graph and outputs the corresponding DIMACS file on standard output. Else, if given 3, outputs on stdout a "graph formatted" text able to generate a complete bipartite graph with m left vertices and n right ones.

Definition at line 165 of file php.cpp.

void pigeonAxiom ( unsigned int  i,
BipartiteGraph  G,
Formula *  form,
VariableSet *  vars 
)

Adds the clause corresponding to the pigeon axiom for the ith pigeon.

Parameters:
iThe index of the pigeon we consider.
GThe BipartiteGraph instance from which to build the formula.
formA pointer to the Formula instance we will append the clause to.
varsThe variable set to use.

Definition at line 50 of file php.cpp.

void pigeonHolePrinciple ( BipartiteGraph  G)

Prints the dimacs formatted CNF formula corresponding to the pigeon hole principle on graph G to the standard output.

Parameters:
GThe BipartiteGraph instance from which to create formula.

Definition at line 102 of file php.cpp.

void randomNeighbours ( unsigned int  leftOrder,
unsigned int  n 
)

Prints on standard output the graph file corresponding to a graph with n+1 left vertives, n right vertices and such that all the left vertices have leftOrder neighbours picked uniformly randomly among the right ones.

Parameters:
leftOrderThe number of random distinct neighbours each left vertex must have.
nThe number of left vertices (and the number of right ones minus one).

Definition at line 127 of file php.cpp.

unsigned int string2uint ( std::string  str)

Transforms a C++ string into an unsigned int using stream buffers.

Parameters:
strThe string to turn into a number.
Returns:
The corresponding integer.

Definition at line 30 of file php.cpp.

 All Files Functions