Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VIGNET Pierre
cadbiom
Commits
3c95538f
Commit
3c95538f
authored
Dec 20, 2019
by
VIGNET Pierre
Browse files
[lib] CLUnfolder: Fix explanations of get_var_name(), get_var_indexed_name()
parent
1ec9eb87
Changes
1
Hide whitespace changes
Inline
Side-by-side
library/cadbiom/models/clause_constraints/mcl/CLUnfolder.py
View file @
3c95538f
...
...
@@ -586,7 +586,7 @@ class CLUnfolder(object):
def
get_var_name
(
self
,
var_num
):
"""Get name of the variable
.. seealso:: Explanations
on
get_var_indexed_name
()
.. seealso:: Explanations
are on :meth:`
get_var_indexed_name
`
@param var_num: DIMACS literal coding of an initial variable
@return: name of the variable
...
...
@@ -598,9 +598,8 @@ class CLUnfolder(object):
# => variable from the initial system
return
self
.
__var_list
[
var_code
]
else
:
# auxiliary variable introduced by properties compilation
return
self
.
__aux_list
[
var_code
-
self
.
shift_step_init
-
1
]
#raise MCLException("Not a DIMACS code of an initial variable")
# Auxiliary variable introduced by properties compilation
return
self
.
__aux_list
[
var_code
-
self
.
shift_step_init
-
1
]
def
get_var_indexed_name
(
self
,
var_num
):
"""Get name of the variable with the time index appended
...
...
@@ -608,9 +607,10 @@ class CLUnfolder(object):
.. note:: time index is the number of steps since the begining of the
simulation.
:Example:
__shift_step = 2 (current step of the unfolding)
shift_step_init = 2 (number of variables in the system)
:Example - Only standard variables:
__shift_step = 2 (number of variables in the system)
shift_step_init = 2 (number of variables in the system at the initial state)
__var_list = ["##", "n1", "n2"]
Virtual list of indexes in the state vector of a solution:
...
...
@@ -625,6 +625,35 @@ class CLUnfolder(object):
=> return: "n1_3"
:Example - With an auxiliary variable:
__shift_step = 2 (There is 1 auxiliary variable)
shift_step_init = 1
__var_list = ["##", "n1"]
__aux_list = ["_lit0"]
Virtual list of indexes in the state vector of a solution:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...]
#|n1,_lit0|n1,_lit0|n1,_lit0|
ti=0 ti=1 ti=2
If the index is > shift_step_init, then it is an auxiliary
variable. In order to get the index in __aux_list we have to
substract:
- ``1` because on the contrary of __var_list, __aux_list begins at index 0
- `shift_step_init` because value of the first aux variable
follows the last value of __var_list
Given var_num = 6
var_code of var_name: ((6-1) % 2) + 1 = 2
2 > shift_step_init
index of var_name in __aux_list:
var_code - shift_step_init - 1
2 -1 -1 = 0
var_name = "_lit0"
=> return: "_lit0_2"
@param var_num: DIMACS literal coding
@return: name of the variable with the time index appended
"""
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment