[6ba162] | 1 | // testdata.h |
---|
| 2 | |
---|
| 3 | // This file provides an interface for generating test data. |
---|
| 4 | |
---|
| 5 | #ifndef TESTDATA_H |
---|
| 6 | #define TESTDATA_H |
---|
| 7 | |
---|
| 8 | #include "globals.h" |
---|
| 9 | |
---|
| 10 | extern int random_matrix(const short& rows, const short& columns, |
---|
| 11 | const Integer& lower_bound, |
---|
| 12 | const Integer& upper_bound, |
---|
| 13 | ofstream& MATRIX); |
---|
| 14 | |
---|
| 15 | // Creates a random matrix of size rows x columns with entries between |
---|
| 16 | // lower_bound and upper_bound. This matrix is written in the MATRIX file |
---|
| 17 | // in the format explained in IP_algorithms.h, together with a randomly |
---|
| 18 | // generated (integer) cost vector with entries between 0 and upper_bound. |
---|
| 19 | |
---|
| 20 | // The positive row space vector needed by the algorithms of Hosten/Sturmfels |
---|
| 21 | // and Bigatti/LaScala/Robbiano has to be entered by hand. It can be computed |
---|
| 22 | // (or its existence can be verified) with the Simplex algorithm that is not |
---|
| 23 | // included in this package. |
---|
| 24 | |
---|
| 25 | extern int transportation_problem(const short& sources, const short& targets, |
---|
| 26 | const Integer& upper_bound, |
---|
| 27 | ofstream& MATRIX); |
---|
| 28 | |
---|
| 29 | // Creates a transportation problem with the given number of sources and |
---|
| 30 | // targets. This involves creating the (fixed) constraint matrix of size |
---|
| 31 | // (sources + targets) x (sources * targets) and a randomly chosen cost vector |
---|
| 32 | // (the "transportation matrix") of size targets*sources with entries between |
---|
| 33 | // 0 and upper_bound. |
---|
| 34 | |
---|
| 35 | // In the case of the transportation problem, a positive row space vector |
---|
| 36 | // is given e.g. by the vector where all entries are 1, so it is printed |
---|
| 37 | // automatically. |
---|
| 38 | |
---|
| 39 | extern int random_problems (const short& vector_dimension, |
---|
| 40 | const long& number_of_instances, |
---|
| 41 | const Integer& lower_bound, |
---|
| 42 | const Integer& upper_bound, |
---|
| 43 | ofstream& PROBLEM); |
---|
| 44 | |
---|
| 45 | // Creates number_of_instances random vectors of size vector_dimension |
---|
| 46 | // with entries beteewn lower_bound and upper_bound. These vectors are |
---|
| 47 | // written in the PROBLEM file in the format explained in IP_algorithms.h. |
---|
| 48 | |
---|
| 49 | // For the (Positive) Conti-Traverso algorithm it might be more useful to |
---|
| 50 | // generate some problems by hand (randomly created instances show to be |
---|
| 51 | // unsolvable in many cases). |
---|
| 52 | |
---|
| 53 | #endif // TESTDATA_H |
---|