Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OptLP
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PMC-SOG
OptLP
Commits
cd976d62
Commit
cd976d62
authored
4 months ago
by
Jaime Arias
Browse files
Options
Downloads
Patches
Plain Diff
refactor: use static_cast in the GetTime function
parent
52035ca5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#8739
failed with stages
in 1 minute and 15 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/main.cpp
+5
-10
5 additions, 10 deletions
app/main.cpp
src/utils.cpp
+4
-0
4 additions, 0 deletions
src/utils.cpp
src/utils.h
+6
-0
6 additions, 0 deletions
src/utils.h
with
15 additions
and
10 deletions
app/main.cpp
+
5
−
10
View file @
cd976d62
...
...
@@ -13,11 +13,6 @@
using
namespace
std
;
// Fonction pour obtenir le temps actuel en secondes
double
getTime
()
{
return
(
double
)
clock
()
/
(
double
)
CLOCKS_PER_SEC
;
}
// Fonction pour afficher l'aide
void
printHelp
()
{
std
::
cout
...
...
@@ -82,14 +77,14 @@ int main(int argc, char *argv[]) {
// print the Graph
/* cout << g->toString() << endl; */
float
start_time
=
g
etTime
();
float
start_time
=
G
etTime
();
// generate the regex
Lg
languages
=
RegexGenerator
::
generate
(
g
);
cout
<<
"End RegexGenerator"
<<
endl
;
/* cout << "Language: " << RegexGenerator::language(languages) << endl; */
float
expr_time
=
g
etTime
()
-
start_time
;
float
expr_time
=
G
etTime
()
-
start_time
;
cout
<<
"
\n
Fin expreg time: "
<<
expr_time
<<
" seconds"
<<
endl
;
// vector of generated paths
...
...
@@ -102,7 +97,7 @@ int main(int argc, char *argv[]) {
}
}
float
paths_time
=
g
etTime
()
-
expr_time
;
float
paths_time
=
G
etTime
()
-
expr_time
;
cout
<<
"
\n
Fin generate paths time: "
<<
paths_time
<<
" seconds"
<<
endl
;
cout
<<
"nb of no null paths "
<<
generate_paths
.
size
()
<<
endl
;
...
...
@@ -213,7 +208,7 @@ int main(int argc, char *argv[]) {
const
operations_research
::
MPSolver
::
ResultStatus
result_status
=
solver
->
Solve
();
float
lp_time
=
g
etTime
()
-
paths_time
;
float
lp_time
=
G
etTime
()
-
paths_time
;
cout
<<
"
\n
Fin PL time: "
<<
lp_time
<<
" seconds"
<<
endl
;
// Vérifiez que le problème a une solution optimale.
...
...
@@ -280,7 +275,7 @@ int main(int argc, char *argv[]) {
// cout << "Statistics : ";
// cout << solver->iterations()<<endl;
float
elapsed_time
=
g
etTime
()
-
start_time
;
float
elapsed_time
=
G
etTime
()
-
start_time
;
cout
<<
"
\n
Total time: "
<<
elapsed_time
<<
" seconds"
<<
endl
;
return
0
;
}
This diff is collapsed.
Click to expand it.
src/utils.cpp
+
4
−
0
View file @
cd976d62
...
...
@@ -10,3 +10,7 @@ bool IsNumeric(const std::string &str) {
return
std
::
all_of
(
str
.
begin
(),
str
.
end
(),
::
isdigit
);
}
double
GetTime
()
{
return
static_cast
<
double
>
(
clock
())
/
static_cast
<
double
>
(
CLOCKS_PER_SEC
);
}
This diff is collapsed.
Click to expand it.
src/utils.h
+
6
−
0
View file @
cd976d62
...
...
@@ -11,4 +11,10 @@
*/
bool
IsNumeric
(
const
std
::
string
&
str
);
/**
* Get the current time
* @return the current time
*/
double
GetTime
();
#endif // UTILS_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment