Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cadbiom
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
VIGNET Pierre
cadbiom
Commits
e3acafbb
Commit
e3acafbb
authored
5 years ago
by
VIGNET Pierre
Browse files
Options
Downloads
Patches
Plain Diff
[lib] Adjust logging, prepare for the switch INFO -> DEBUG
parent
29748108
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
library/cadbiom/models/clause_constraints/mcl/CLUnfolder.py
+5
-6
5 additions, 6 deletions
library/cadbiom/models/clause_constraints/mcl/CLUnfolder.py
library/cadbiom/models/clause_constraints/mcl/MCLAnalyser.py
+33
-9
33 additions, 9 deletions
library/cadbiom/models/clause_constraints/mcl/MCLAnalyser.py
with
38 additions
and
15 deletions
library/cadbiom/models/clause_constraints/mcl/CLUnfolder.py
+
5
−
6
View file @
e3acafbb
...
...
@@ -832,7 +832,7 @@ class CLUnfolder(object):
self
.
__precomputed_dynamic_constraints
[
self
.
__current_step
]
)
LOGGER
.
info
(
"
__
shift_dynamic:: OPTI
-
DO NOT SHIFT;
"
"
shift_dynamic:: OPTI
DO NOT SHIFT;
"
"
Reload dynamic constraints; step: %s
"
,
self
.
__current_step
)
...
...
@@ -840,7 +840,7 @@ class CLUnfolder(object):
# System has not been shifted for this step until now
LOGGER
.
info
(
"
__
shift_dynamic:: SHIFT;
"
"
shift_dynamic:: SHIFT;
"
"
Set dynamic constraints; step: %s; dyn consts len: %s
"
,
self
.
__current_step
,
len
(
self
.
__dynamic_constraints
)
...
...
@@ -1340,7 +1340,6 @@ class CLUnfolder(object):
solv
.
add_clauses
(
it
.
chain
(
*
self
.
__dynamic_constraints
))
solv
.
add_clauses
(
self
.
__initial_constraints
)
# LOGGING
if
LOGGER
.
getEffectiveLevel
()
==
DEBUG
:
# final
LOGGER
.
debug
(
"
Load new solver !!
"
)
...
...
@@ -1476,7 +1475,7 @@ class CLUnfolder(object):
# Auto shift loop: Shift without checking (optimization)
# Do not search solutions before the specified limit
while
self
.
__current_step
<
self
.
__steps_before_check
:
print
(
"
SATIS TEST
AUTO SHIFT
opti
"
)
LOGGER
.
info
(
"
Satis test:: OPTI
AUTO SHIFT
"
)
self
.
shift
()
satisfiability_test
=
False
...
...
@@ -1487,7 +1486,7 @@ class CLUnfolder(object):
# Test satisfiability
satisfiability_test
=
self
.
__constraints_satisfied
()
print
(
"
SATIS TEST
done, current_step
"
,
self
.
__current_step
)
LOGGER
.
info
(
"
Satis test::
done, current_step
%s
"
,
self
.
__current_step
)
if
satisfiability_test
:
return
True
...
...
@@ -1552,7 +1551,7 @@ class CLUnfolder(object):
# Do not search solutions before the specified limit
print
(
"
squery_solve: begining; current_step:
"
,
self
.
__current_step
,
"
max_step:
"
,
max_step
)
while
self
.
__current_step
<
self
.
__steps_before_check
:
print
(
"
AUTO SHIFT
opti
"
)
LOGGER
.
info
(
"
Solve: OPTI
AUTO SHIFT
"
)
self
.
shift
()
# Search for solutions for each remaining step
...
...
This diff is collapsed.
Click to expand it.
library/cadbiom/models/clause_constraints/mcl/MCLAnalyser.py
+
33
−
9
View file @
e3acafbb
...
...
@@ -199,8 +199,11 @@ from cadbiom.models.guard_transitions.translators.cadlangParser import cadlangPa
from
cadbiom.models.guard_transitions.chart_model
import
ChartModel
from
cadbiom.models.clause_constraints.mcl.MCLSolutions
import
FrontierSolution
,
DimacsFrontierSol
from
cadbiom.models.clause_constraints.mcl.MCLQuery
import
MCLSimpleQuery
from
cadbiom
import
commons
as
cm
# Standard imports
from
logging
import
DEBUG
,
INFO
LOGGER
=
cm
.
logger
()
...
...
@@ -427,7 +430,12 @@ class MCLAnalyser(object):
max_step
,
self
.
nb_sols_to_be_pruned
)
print
(
"
iteration
"
,
i
,
"
nb pruned inact solutions
"
,
len
(
dimacs_solutions
))
LOGGER
.
info
(
"
MCLA::Prune: Iteration %s, nb pruned inact solutions: %s
"
,
i
,
len
(
dimacs_solutions
)
)
####TODO: regarder si ces solutions sont si différentes et ce qu'on en fait au final...
### en fin de compte il est possible que le solveur ne soit pas si bete...
##TODO: ajuster automatiquement nb_sols_to_be_pruned
...
...
@@ -443,12 +451,18 @@ class MCLAnalyser(object):
next_sol
=
self
.
less_activated_solution
(
dimacs_solutions
)
next_len
=
next_sol
.
nb_activated_frontiers
is_pruned
=
current_len
>
next_len
LOGGER
.
info
(
"
MCLA::Prune: Current solution activated length:%s next:%s
"
,
current_len
,
next_len
)
if
is_pruned
:
sol_to_prune
=
next_sol
current_len
=
next_len
# never reach this point
raise
MCLException
(
"
MCLAnalyser:__prune_frontier_solution:: what happened?
?
"
)
raise
MCLException
(
"
MCLAnalyser:__prune_frontier_solution:: what happened?
"
)
## Generic solver for simple queries #######################################
...
...
@@ -618,8 +632,16 @@ class MCLAnalyser(object):
raw_sols
=
self
.
sq_solutions
(
query
,
max_step
,
max_sol
,
vvars
)
# Get unique DimacsFrontierSol objects from RawSolution objects
dimacfrontsol
=
DimacsFrontierSol
.
get_unique_dimacs_front_sols_from_raw_sols
(
raw_sols
)
print
(
"
Nb activated in dimacsfrontsols
"
,
[
len
(
sol
)
for
sol
in
dimacfrontsol
])
print
(
"
Nb queried:
"
,
max_sol
,
"
steps
"
,
max_step
,
"
obtenu
"
,
len
(
dimacfrontsol
))
if
LOGGER
.
getEffectiveLevel
()
==
INFO
:
LOGGER
.
info
(
"
MCLA: Nb queried: %s, steps: %s
\n
"
"
\t
get: %s, unique: %s
\n
"
"
\t
activated fronts per dimacfrontsol: %s
"
,
max_sol
,
max_step
,
len
(
raw_sols
),
len
(
dimacfrontsol
),
[
len
(
sol
)
for
sol
in
dimacfrontsol
]
)
return
dimacfrontsol
...
...
@@ -700,7 +722,8 @@ class MCLAnalyser(object):
# If we do not want to self-adjust steps, just break the loop
# break
print
(
"
NOT FOUND - current step ?
"
,
self
.
unfolder
.
get_current_step
())
LOGGER
.
info
(
"
MCLA: NOT FOUND -> satis test; current step %s
"
,
self
.
unfolder
.
get_current_step
())
if
self
.
unfolder
.
get_current_step
()
+
1
>
max_user_step
:
# Cosmetic break, avoid to do useless test
break
...
...
@@ -740,9 +763,6 @@ class MCLAnalyser(object):
# => reduce the number of activated variables
current_mac
=
self
.
__prune_frontier_solution
(
small_fsol
,
query
,
min_step
)
## TEST
print
(
"
__mac_exhaustive_search:: final current step ?
"
,
self
.
unfolder
.
get_current_step
())
yield
current_mac
# mac_list.append(current_mac)
...
...
@@ -752,6 +772,10 @@ class MCLAnalyser(object):
forbidden_frontier_values
.
append
(
[
-
var
for
var
in
current_mac
.
activated_frontier_values
]
)
LOGGER
.
debug
(
"
MCLA::mac_exhaustive_search: forbidden frontiers: %s
"
,
forbidden_frontier_values
)
def
next_mac
(
self
,
query
,
max_step
):
"""
Search a Minimal Access Condition for the given query.
...
...
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