Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "system.h"
00012 #include "gnrl.h"
00013 #include "lap.h"
00014
00015
00016 void main()
00017 {
00018 #define COSTRANGE 1000.0
00019 #define PRINTCOST 0
00020
00021 int dim, startdim, enddim;
00022 cost **assigncost, *u, *v, lapcost;
00023 row i, *colsol;
00024 col j, *rowsol;
00025 double runtime;
00026
00027 printf("start dimension ?\n");
00028 scanf("%d", &startdim);
00029 printf("end dimension ?\n");
00030 scanf("%d", &enddim);
00031 printf("\ndimensions %d .. %d\n", startdim, enddim);
00032
00033 assigncost = new cost*[enddim];
00034 for (i = 0; i < enddim; i++)
00035 assigncost[i] = new cost[enddim];
00036
00037 rowsol = new col[enddim];
00038 colsol = new row[enddim];
00039 u = new cost[enddim];
00040 v = new cost[enddim];
00041
00042 for (dim = startdim; dim <= enddim; dim++)
00043 {
00044 seedRandom(1000 * dim);
00045
00046
00047 random(); random(); random(); random(); random();
00048 for (i = 0; i < dim; i++)
00049 for (j = 0; j < dim; j++)
00050 assigncost[i][j] = (cost) (random() * (double) COSTRANGE);
00051
00052 #if (PRINTCOST)
00053 for (i = 0; i < dim; i++)
00054 {
00055 printf("\n");
00056 for (j = 0; j < dim; j++)
00057 printf("%4d ", assigncost[i][j]);
00058 }
00059 #endif
00060
00061 printf("\nstart\n");
00062 runtime = seconds();
00063 lapcost = lap(dim, assigncost, rowsol, colsol, u, v);
00064 runtime = seconds() - runtime;
00065 printf("\n\ndim %4d - lap cost %5d - runtime %6.3f\n", dim, lapcost, runtime);
00066
00067 checklap(dim, assigncost, rowsol, colsol, u, v);
00068 }
00069
00070 delete[] assigncost;
00071 delete[] rowsol;
00072 delete[] colsol;
00073 delete[] u;
00074 delete[] v;
00075
00076 printf("\n\npress key\n");
00077 char c;
00078 scanf("%d", &c);
00079 }
00080