Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
racr-mquat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
René Schöne
racr-mquat
Commits
508a9cc1
Commit
508a9cc1
authored
9 years ago
by
René Schöne
Browse files
Options
Downloads
Patches
Plain Diff
always calculate stats.
parent
d26d4b6c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ilp_measurement.py
+10
-4
10 additions, 4 deletions
ilp_measurement.py
with
10 additions
and
4 deletions
ilp_measurement.py
+
10
−
4
View file @
508a9cc1
...
@@ -115,7 +115,8 @@ def prepare_dstat(f):
...
@@ -115,7 +115,8 @@ def prepare_dstat(f):
@task
(
name
=
'
sol
'
)
@task
(
name
=
'
sol
'
)
def
sol
(
number
=
1
,
solver
=
'
glpsol
'
,
pathname
=
'
*
'
,
skip_conflate
=
False
,
timeout
=
40
):
def
sol
(
number
=
1
,
solver
=
'
glpsol
'
,
pathname
=
'
*
'
,
skip_conflate
=
False
,
timeout
=
40
):
"""
Run solver n times (default: once)
"""
"""
Run solver n times (default: once)
Possible solvers: glpsol (default), gurobi
"""
do_sol
(
solver
,
int
(
number
),
pathname
,
skip_conflate
,
int
(
timeout
))
do_sol
(
solver
,
int
(
number
),
pathname
,
skip_conflate
,
int
(
timeout
))
params
=
{
'
glpsol
'
:
[
'
glpsol --tmlim {timeout} --lp {lp} -w {sol}
'
,
'
INTEGER OPTIMAL SOLUTION FOUND
'
,
'
Time used:[\s]*(.*?) secs
'
,
'
(\d+) rows, (\d+) columns, (\d+) non-zeros
'
],
params
=
{
'
glpsol
'
:
[
'
glpsol --tmlim {timeout} --lp {lp} -w {sol}
'
,
'
INTEGER OPTIMAL SOLUTION FOUND
'
,
'
Time used:[\s]*(.*?) secs
'
,
'
(\d+) rows, (\d+) columns, (\d+) non-zeros
'
],
...
@@ -130,6 +131,9 @@ def do_sol(solver, number, pathname, skip_conflate, timeout):
...
@@ -130,6 +131,9 @@ def do_sol(solver, number, pathname, skip_conflate, timeout):
if
not
os
.
path
.
isdir
(
d
):
if
not
os
.
path
.
isdir
(
d
):
print
red
(
"
Not a valid directory: {0}
"
.
format
(
d
))
print
red
(
"
Not a valid directory: {0}
"
.
format
(
d
))
continue
continue
if
'
-noncached-
'
in
d
or
'
-flushed-
'
in
d
:
# skip this, as ILP would be the same
continue
sys
.
stdout
.
write
(
d
)
sys
.
stdout
.
write
(
d
)
os
.
chdir
(
d
)
os
.
chdir
(
d
)
files
=
glob
(
'
*.lp
'
)
files
=
glob
(
'
*.lp
'
)
...
@@ -156,12 +160,14 @@ def do_sol(solver, number, pathname, skip_conflate, timeout):
...
@@ -156,12 +160,14 @@ def do_sol(solver, number, pathname, skip_conflate, timeout):
today
=
datetime
.
today
()
today
=
datetime
.
today
()
if
re
.
search
(
params
[
solver
][
1
],
out
):
if
re
.
search
(
params
[
solver
][
1
],
out
):
duration
=
re
.
search
(
params
[
solver
][
2
],
out
).
group
(
1
)
duration
=
re
.
search
(
params
[
solver
][
2
],
out
).
group
(
1
)
# stats=row,col,nonzero
stats
=
re
.
search
(
params
[
solver
][
3
],
out
).
groups
()
sys
.
stdout
.
write
(
'
.
'
)
sys
.
stdout
.
write
(
'
.
'
)
else
:
else
:
sys
.
stdout
.
write
(
red
(
'
!
'
))
duration
=
-
1
duration
=
-
1
sys
.
stdout
.
write
(
red
(
'
!
'
))
# stats=row,col,nonzero
stats
=
re
.
search
(
params
[
solver
][
3
],
out
).
groups
()
if
len
(
stats
)
==
0
:
stats
=
[
-
1
,
-
1
,
-
1
]
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
row
=
list
((
today
.
isoformat
(),
dirname
(
d
),
ilp
.
rsplit
(
'
.
'
,
1
)[
0
])
+
row
=
list
((
today
.
isoformat
(),
dirname
(
d
),
ilp
.
rsplit
(
'
.
'
,
1
)[
0
])
+
stats
+
(
duration
,
stop
-
start
))
stats
+
(
duration
,
stop
-
start
))
...
...
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