Frobby 0.9.5
randomDataGenerators.cpp File Reference
#include "stdinc.h"
#include "randomDataGenerators.h"
#include "BigIdeal.h"
#include "Ideal.h"
#include "Term.h"
#include "error.h"
#include "FrobbyStringStream.h"
#include <limits>
#include <ctime>
#include <sys/types.h>
#include <unistd.h>

Go to the source code of this file.

Functions

void generateLinkedListIdeal (BigIdeal &ideal, size_t variableCount)
 Generate an ideal of the form $x_1*x_2$, $x_2*x_3$ and so on.
 
void generateChessIdeal (BigIdeal &bigIdeal, size_t rowCount, size_t columnCount, int deltaRow[], int deltaColumn[], size_t deltaCount)
 
void generateKingChessIdeal (BigIdeal &ideal, size_t rowsAndColumns)
 Generate an ideal where $x_(a,b)*x_(c,d)$ is a generator when $(a,b)$ and $(c,d)$ indicate coordinates on a square chessboard where the move is a valid king's move.
 
void generateKnightChessIdeal (BigIdeal &ideal, size_t rowsAndColumns)
 Generate an ideal where $x_(a,b)*x_(c,d)$ is a generator when $(a,b)$ and $(c,d)$ indicate coordinates on a square chessboard where the move is a valid knight's move.
 
void generateTreeIdeal (BigIdeal &ideal, size_t varCount)
 Generate an ideal in varCount variables with minimal generators given by.
 
void generateRookChessIdeal (BigIdeal &bigIdeal, size_t n, size_t k)
 Generate an ideal in n*k variables.
 
void generateMatchingIdeal (BigIdeal &bigIdeal, size_t n)
 Generate an ideal whose facets are the maximum matchings in an n-clique.
 
bool generateRandomEdgeIdeal (BigIdeal &bigIdeal, size_t variableCount, size_t generatorCount)
 Generate a random ideal where every edge is a product of two different variables.
 
bool generateRandomIdeal (BigIdeal &bigIdeal, size_t exponentRange, size_t variableCount, size_t generatorCount)
 Generate a random ideal with exponents in the range [0, exponentRange].
 
void generateRandomFrobeniusInstance (vector< mpz_class > &instance, size_t entryCount, const mpz_class &maxEntry)
 Generate a random vector of numbers whose gcd is 1.
 

Function Documentation

◆ generateChessIdeal()

void generateChessIdeal ( BigIdeal & bigIdeal,
size_t rowCount,
size_t columnCount,
int deltaRow[],
int deltaColumn[],
size_t deltaCount )

Definition at line 42 of file randomDataGenerators.cpp.

◆ generateKingChessIdeal()

void generateKingChessIdeal ( BigIdeal & ideal,
size_t rowsAndColumns )

Generate an ideal where $x_(a,b)*x_(c,d)$ is a generator when $(a,b)$ and $(c,d)$ indicate coordinates on a square chessboard where the move is a valid king's move.

Definition at line 102 of file randomDataGenerators.cpp.

◆ generateKnightChessIdeal()

void generateKnightChessIdeal ( BigIdeal & ideal,
size_t rowsAndColumns )

Generate an ideal where $x_(a,b)*x_(c,d)$ is a generator when $(a,b)$ and $(c,d)$ indicate coordinates on a square chessboard where the move is a valid knight's move.

Definition at line 113 of file randomDataGenerators.cpp.

◆ generateLinkedListIdeal()

void generateLinkedListIdeal ( BigIdeal & ideal,
size_t variableCount )

Generate an ideal of the form $x_1*x_2$, $x_2*x_3$ and so on.

Definition at line 31 of file randomDataGenerators.cpp.

◆ generateMatchingIdeal()

void generateMatchingIdeal ( BigIdeal & bigIdeal,
size_t n )

Generate an ideal whose facets are the maximum matchings in an n-clique.

Definition at line 224 of file randomDataGenerators.cpp.

◆ generateRandomEdgeIdeal()

bool generateRandomEdgeIdeal ( BigIdeal & ideal,
size_t varCount,
size_t generatorCount )

Generate a random ideal where every edge is a product of two different variables.

Returns true if the requested number of generators was achieved.

Definition at line 392 of file randomDataGenerators.cpp.

◆ generateRandomFrobeniusInstance()

void generateRandomFrobeniusInstance ( vector< mpz_class > & instance,
size_t entryCount,
const mpz_class & maxEntry )

Generate a random vector of numbers whose gcd is 1.

Todo
: preserve state across calls.

Definition at line 460 of file randomDataGenerators.cpp.

◆ generateRandomIdeal()

bool generateRandomIdeal ( BigIdeal & bigIdeal,
size_t exponentRange,
size_t varCount,
size_t generatorCount )

Generate a random ideal with exponents in the range [0, exponentRange].

Returns true if the requested number of generators was achieved.

Definition at line 429 of file randomDataGenerators.cpp.

◆ generateRookChessIdeal()

void generateRookChessIdeal ( BigIdeal & bigIdeal,
size_t n,
size_t k )

Generate an ideal in n*k variables.

Each facet corresponds to a way of placing rooks on an n*k chessboard without any rooks being able to take any other rook in one move.

Definition at line 171 of file randomDataGenerators.cpp.

◆ generateTreeIdeal()

void generateTreeIdeal ( BigIdeal & ideal,
size_t varCount )

Generate an ideal in varCount variables with minimal generators given by.

\[
\left\langle
  \left.
    \left(
      \prod_{i\in F}x_i
    \right)^{n-|F|+1}
  \right|
  \emptyset\neq F\subseteq
  \left\{
    1,\ldots,n
  \right\}
\right\rangle
,\]

i.e. to get the minimal generators, take each square free monomial except the identity, and raise it to the power of varCount + 1 minus it's total degree.

Definition at line 145 of file randomDataGenerators.cpp.