1
- function denseMenu(m , n )
2
- % Filename: denseMenu.m
3
- % Description: Custom menu for creating dense random LPs
4
- % Authors: Ploskas, N., & Samaras, N.
5
- %
6
- % Syntax: denseMenu(m, n)
7
- %
8
- % Input:
9
- % -- m: the number of constraints of the generated random LPs
10
- % -- n: the number of variables of the generated random LPs
11
- %
12
- % Output: files that store the generated dense random LPs
13
-
14
- % read the directory to store the LPs
15
- pathName = input([' Please give the path where you want ' ...
16
- ' to store the generated LPs: ' ]);
17
- % read the number of the LPs to generate
18
- nOfProblems = input([' Please give the number of the LPs ' ...
19
- ' that you want to create: ' ]);
20
- % read the ranges of the values for matrix A
21
- Alu = input([' Please give the range of the values for ' ...
22
- ' matrix A: ' ]);
23
- % read the ranges of the values for vector c
24
- clu = input([' Please give the range of the values for ' ...
25
- ' vector c: ' ]);
26
- % read the type of optimization
27
- optType = input([' Please give the type of optimization ' ...
28
- ' (0 min, 1 max, 2 random): ' ]);
29
- % read if all LPs will be optimal
30
- optimality = input([' Do you want all the LPs to be ' ...
31
- ' optimal (1 yes, 2 no): ' ]);
32
- if optimality == 1 % optimal LPs
33
- % read the center of the circle
34
- center = input([' Please give the center of the circle: ' ]);
35
- % read the radius of the circle
36
- R = input([' Please give the radius of the circle ' ...
37
- ' (must be less than the center of the circle: ' ]);
38
- while R >= center % read R
39
- R = input([' Please give the radius of the circle ' ...
40
- ' (must be less than the center of the circle: ' ]);
41
- end
42
- % create nOfProblems dense random optimal LPs
43
- for i = 1 : nOfProblems
44
- [A , c , b , Eqin , MinMaxLP ] = denseRandomOptimal(m , n , ...
45
- optType , Alu , clu , center , R );
46
- s1 = num2str(m );
47
- s2 = num2str(n );
48
- k = num2str(i );
49
- fname = [pathName ' /' ' fdata' k ' _' s1 ' x' s2 ];
50
- Name = [' fdata' k ' _' s1 ' x' s2 ];
51
- R = [];
52
- BS = [];
53
- NonZeros = nnz(A );
54
- c0 = 0 ;
55
- c00 = 0 ;
56
- % save variables in a MAT file
57
- eval([' save ' fname ' .mat A c b Eqin MinMaxLP Name ' ...
58
- ' R BS NonZeros c0 c00' ]);
59
- end
60
- else % not optimal LPs
61
- % read the ranges of the values for vector b
62
- blu = input([' Please give the range of the values for ' ...
63
- ' vector b: ' ]);
64
- % read the ranges of the values for vector Eqin
65
- Eqinlu = input([' Please give the range of the values ' ...
66
- ' for vector Eqin (0 - equality constraints, 1 - ' ...
67
- ' less than or equal to inequality constraints, ' ...
68
- ' 2 - greater than or equal to inequality ' ...
69
- ' constraints: ' ]);
70
- for i = 1 : nOfProblems % create nOfProblems dense random LPs
71
- [A , c , b , Eqin , MinMaxLP ] = denseRandom(m , n , ...
72
- optType , Alu , clu , blu , Eqinlu );
73
- s1 = num2str(m );
74
- s2 = num2str(n );
75
- k = num2str(i );
76
- fname = [pathName ' /' ' fdata' k ' _' s1 ' x' s2 ];
77
- Name = [' fdata' k ' _' s1 ' x' s2 ];
78
- R = [];
79
- BS = [];
80
- NonZeros = nnz(A );
81
- c0 = 0 ;
82
- c00 = 0 ;
83
- % save variables in a MAT file
84
- eval([' save ' fname ' .mat A c b Eqin MinMaxLP Name ' ...
85
- ' R BS NonZeros c0 c00' ]);
86
- end
87
- end
88
- end
1
+ function denseMenu(m , n )
2
+ % Filename: denseMenu.m
3
+ % Description: Custom menu for creating dense random LPs
4
+ % Authors: Ploskas, N., & Samaras, N.
5
+ %
6
+ % Syntax: denseMenu(m, n)
7
+ %
8
+ % Input:
9
+ % -- m: the number of constraints of the generated random LPs
10
+ % -- n: the number of variables of the generated random LPs
11
+ %
12
+ % Output: files that store the generated dense random LPs
13
+
14
+ % read the directory to store the LPs
15
+ pathName = input([' Please give the path where you want ' ...
16
+ ' to store the generated LPs: ' ]);
17
+ % read the number of the LPs to generate
18
+ nOfProblems = input([' Please give the number of the LPs ' ...
19
+ ' that you want to create: ' ]);
20
+ % read the ranges of the values for matrix A
21
+ Alu = input([' Please give the range of the values for ' ...
22
+ ' matrix A: ' ]);
23
+ % read the ranges of the values for vector c
24
+ clu = input([' Please give the range of the values for ' ...
25
+ ' vector c: ' ]);
26
+ % read the type of optimization
27
+ optType = input([' Please give the type of optimization ' ...
28
+ ' (0 min, 1 max, 2 random): ' ]);
29
+ % read if all LPs will be optimal
30
+ optimality = input([' Do you want all the LPs to be ' ...
31
+ ' optimal (1 yes, 2 no): ' ]);
32
+ if optimality == 1 % optimal LPs
33
+ % read the center of the circle
34
+ center = input([' Please give the center of the circle: ' ]);
35
+ % read the radius of the circle
36
+ R = input([' Please give the radius of the circle ' ...
37
+ ' (must be less than the center of the circle: ' ]);
38
+ while R >= center % read R
39
+ R = input([' Please give the radius of the circle ' ...
40
+ ' (must be less than the center of the circle: ' ]);
41
+ end
42
+ % create nOfProblems dense random optimal LPs
43
+ for i = 1 : nOfProblems
44
+ [A , c , b , Eqin , MinMaxLP ] = denseRandomOptimal(m , n , ...
45
+ optType , Alu , clu , center , R );
46
+ s1 = num2str(m );
47
+ s2 = num2str(n );
48
+ k = num2str(i );
49
+ fname = [pathName ' /' ' fdata' k ' _' s1 ' x' s2 ];
50
+ Name = [' fdata' k ' _' s1 ' x' s2 ];
51
+ R = [];
52
+ BS = [];
53
+ NonZeros = nnz(A );
54
+ c0 = 0 ;
55
+ c00 = 0 ;
56
+ % save variables in a MAT file
57
+ eval([' save ' fname ' .mat A c b Eqin MinMaxLP Name ' ...
58
+ ' R BS NonZeros c0 c00' ]);
59
+ end
60
+ else % not optimal LPs
61
+ % read the ranges of the values for vector b
62
+ blu = input([' Please give the range of the values for ' ...
63
+ ' vector b: ' ]);
64
+ % read the ranges of the values for vector Eqin
65
+ Eqinlu = input([' Please give the range of the values ' ...
66
+ ' for vector Eqin (0 - equality constraints, 1 - ' ...
67
+ ' less than or equal to inequality constraints, ' ...
68
+ ' 2 - greater than or equal to inequality ' ...
69
+ ' constraints: ' ]);
70
+ for i = 1 : nOfProblems % create nOfProblems dense random LPs
71
+ [A , c , b , Eqin , MinMaxLP ] = denseRandom(m , n , ...
72
+ optType , Alu , clu , blu , Eqinlu );
73
+ s1 = num2str(m );
74
+ s2 = num2str(n );
75
+ k = num2str(i );
76
+ fname = [pathName ' /' ' fdata' k ' _' s1 ' x' s2 ];
77
+ Name = [' fdata' k ' _' s1 ' x' s2 ];
78
+ R = [];
79
+ BS = [];
80
+ NonZeros = nnz(A );
81
+ c0 = 0 ;
82
+ c00 = 0 ;
83
+ % save variables in a MAT file
84
+ eval([' save ' fname ' .mat A c b Eqin MinMaxLP Name ' ...
85
+ ' R BS NonZeros c0 c00' ]);
86
+ end
87
+ end
88
+ end
0 commit comments