Frobby  0.9.5
GenerateDataFacade.cpp
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see http://www.gnu.org/licenses/.
16 */
17 #include "stdinc.h"
18 #include "GenerateDataFacade.h"
19 
20 #include "randomDataGenerators.h"
21 #include "display.h"
22 
24  Facade(printActions) {
25 }
26 
28  size_t varCount) {
29  beginAction("Generating list ideal.");
30 
31  ::generateLinkedListIdeal(ideal, varCount);
32 
33  endAction();
34 }
35 
37  unsigned int rowsAndColumns) {
38  beginAction("Generating king ideal.");
39 
40  ::generateKingChessIdeal(ideal, rowsAndColumns);
41 
42  endAction();
43 }
44 
46 (BigIdeal& ideal, unsigned int rowsAndColumns) {
47  beginAction("Generating knight ideal.");
48 
49  ::generateKnightChessIdeal(ideal, rowsAndColumns);
50 
51  endAction();
52 }
53 
55 (BigIdeal& ideal, unsigned int n, unsigned int k) {
56  beginAction("Generating rook ideal.");
57 
58  ::generateRookChessIdeal(ideal, n, k);
59 
60  endAction();
61 }
62 
64 (BigIdeal& ideal, unsigned int n) {
65  beginAction("Generating matching ideal.");
66 
67  ::generateMatchingIdeal(ideal, n);
68 
69  endAction();
70 }
71 
73 (BigIdeal& ideal,
74  unsigned int varCount) {
75  beginAction("Generating tree ideal.");
76 
77  ::generateTreeIdeal(ideal, varCount);
78 
79  endAction();
80 }
81 
83 (BigIdeal& ideal, size_t varCount, size_t generatorCount) {
84  beginAction("Generating random edge ideal.");
85 
86  bool fullSize =
87  ::generateRandomEdgeIdeal(ideal, varCount, generatorCount);
88 
89  if (!fullSize)
90  displayNote("Generated ideal has fewer minimal "
91  "generators than requested.\n");
92 
93  endAction();
94 }
95 
97  size_t exponentRange,
98  size_t varCount,
99  size_t generatorCount) {
100  beginAction("Generating random monomial ideal.");
101 
102  bool fullSize =
103  ::generateRandomIdeal(ideal, exponentRange, varCount, generatorCount);
104 
105  if (!fullSize)
106  displayNote("Generated ideal has fewer minimal "
107  "generators than requested.\n");
108 
109  endAction();
110 }
111 
113 generateFrobeniusInstance(vector<mpz_class>& instance,
114  size_t entryCount,
115  const mpz_class& maxEntry) {
116  beginAction("Generating random Frobenius instance.");
117 
118  ::generateRandomFrobeniusInstance(instance, entryCount, maxEntry);
119 
120  endAction();
121 }
This is the super class of all facades.
Definition: Facade.h:32
void beginAction(const char *message)
Prints message to standard error if printing is turned on, and records the time when the action start...
Definition: Facade.cpp:38
void endAction()
Prints to standard error the time since the last call to beginAction.
Definition: Facade.cpp:51
void generateIdeal(BigIdeal &ideal, size_t exponentRange, size_t varCount, size_t generatorCount)
void generateKingChessIdeal(BigIdeal &ideal, unsigned int rowsAndColumns)
void generateTreeIdeal(BigIdeal &ideal, unsigned int varCount)
GenerateDataFacade(bool printActions)
void generateEdgeIdeal(BigIdeal &ideal, size_t varCount, size_t generatorCount)
void generateFrobeniusInstance(vector< mpz_class > &instance, size_t entryCount, const mpz_class &maxEntry)
void generateKnightChessIdeal(BigIdeal &ideal, unsigned int rowsAndColumns)
void generateRookChessIdeal(BigIdeal &ideal, unsigned int n, unsigned int k)
void generateMatchingIdeal(BigIdeal &ideal, unsigned int n)
void generateListIdeal(BigIdeal &ideal, size_t varCount)
void displayNote(const string &msg)
Display msg to standard error in a way that indicates that this is something that the user should tak...
Definition: display.cpp:135
This file contains functions for printing strings to standard error.
void generateRandomFrobeniusInstance(vector< mpz_class > &instance, size_t entryCount, const mpz_class &maxEntry)
Generate a random vector of numbers whose gcd is 1.
bool generateRandomIdeal(BigIdeal &bigIdeal, size_t exponentRange, size_t variableCount, size_t generatorCount)
Generate a random ideal with exponents in the range [0, exponentRange].
bool generateRandomEdgeIdeal(BigIdeal &bigIdeal, size_t variableCount, size_t generatorCount)
Generate a random ideal where every edge is a product of two different variables.
void generateLinkedListIdeal(BigIdeal &ideal, size_t variableCount)
Generate an ideal of the form , and so on.
This file contains functions that generate data.