Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Maxime POULAIN
OAD - TP2
Commits
aaa9f4b8
Commit
aaa9f4b8
authored
Nov 10, 2021
by
Maxime POULAIN
Browse files
add performance test
parent
6c8ee1f6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Code/.vs/Optimisation/v16/ipch/AutoPCH/5c7ea1b8ff3ef86c/ENTRY.ipch
View file @
aaa9f4b8
No preview for this file type
Code/.vs/Optimisation/v16/ipch/AutoPCH/d0b9248f8dea31e1/MAINFORM.ipch
View file @
aaa9f4b8
No preview for this file type
Code/View/Entry.cpp
View file @
aaa9f4b8
...
...
@@ -11,23 +11,49 @@
#include
"utils.h"
#include
<iostream>
#include
<vector>
#include
<chrono>
void
testPerf
(
void
)
{
using
namespace
std
;
graph_t
graph
;
char
filename
[
128
];
solution_t
solution
;
for
(
int
i
=
1
;
i
<
21
;
i
++
)
{
solution
.
cost
=
INT_FAST16_MAX
;
sprintf_s
(
filename
,
"la%02d.txt"
,
i
);
graph
=
gestionGraph
::
lecture_fichier
(
filename
);
auto
t_start
=
std
::
chrono
::
high_resolution_clock
::
now
();
solution
::
grasp
(
&
solution
,
graph
);
auto
t_end
=
std
::
chrono
::
high_resolution_clock
::
now
();
double
elapsed_time_ms
=
std
::
chrono
::
duration
<
double
,
std
::
milli
>
(
t_end
-
t_start
).
count
();
cout
<<
filename
<<
" : "
<<
solution
.
cost
<<
" in "
<<
elapsed_time_ms
<<
" ms"
<<
endl
;
}
}
void
test10Seq
(
void
)
{
using
namespace
std
;
graph_t
graph
;
graph
=
gestionGraph
::
lecture_fichier
(
"
la01
.txt"
);
graph
=
gestionGraph
::
lecture_fichier
(
"
cours
.txt"
);
solution_t
sol
;
bierwirth_t
v
[
3
0
];
bierwirth_t
v
[
1
0
];
for
(
int
i
=
0
;
i
<
3
0
;
i
++
)
for
(
int
i
=
0
;
i
<
1
0
;
i
++
)
{
v
[
i
]
=
bierwirthManager
::
generateVector
(
graph
.
nb_pieces
,
graph
.
nb_machines
);
cout
<<
to_string
(
i
)
<<
" : "
<<
solution
::
evaluer
(
v
[
i
],
graph
).
cost
<<
" -> "
<<
solution
::
rechercheLocale
(
v
[
i
],
graph
,
1000
).
cost
<<
endl
;
v
[
i
]
=
bierwirthManager
::
generateVector
(
graph
.
nb_pieces
,
graph
.
nb_machines
);
auto
solution
=
solution
::
evaluer
(
v
[
i
],
graph
);
auto
opti
=
solution
::
rechercheLocale
(
v
[
i
],
graph
,
1000
);
cout
<<
to_string
(
i
)
<<
" : "
<<
solution
.
cost
<<
" -> "
<<
opti
.
cost
<<
endl
;
}
string
in
;
cin
>>
in
;
}
...
...
@@ -36,10 +62,11 @@ void test10Seq(void) {
int
main
()
{
srand
(
2145
);
test10Seq
();
srand
(
100145
);
//test10Seq();
testPerf
();
MainForm
form
;
form
.
ShowDialog
();
//
MainForm form;
//
form.ShowDialog();
return
0
;
}
\ No newline at end of file
Code/x64/Debug/View.exe
View file @
aaa9f4b8
No preview for this file type
Code/x64/Debug/View.pdb
View file @
aaa9f4b8
No preview for this file type
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment