Replies: 1 comment
-
I see two options here:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Choco Solver's
hardReset
method resets the domain of the variables to their original state. However, there is inconsistent behavior for variables of typeSetVar
andIntVar
with an enumerated domain. While real variables (RealVar
) and boundedIntVar
are correctly reset, this is not the case forSetVar
and enumeratedIntVar
variables.The inconsistency occurs as follows:
SetVar
is reset to{}
(empty set), regardless of the original domain.Enumerated
IntVar
directly assumes the first value of the domain instead of maintaining the expected behavior (full original domain).Expected behavior:
According to the documentation,
hardReset
should return all variables to the creation state, with their domains complete and unchanged. This behavior works correctly forRealVar
and boundedIntVar
variables, but fails for the other configurations mentioned.For the example, you can see that the domains of
RealVar
(r1
) and bounded IntVar (i1
) are correctly restored to the creation state. However, the domains of SetVar (s1
), which is reset to{}
(empty set), and EnumeratedIntVar
(i2
), which automatically takes on the first value of the domain, do not reflect the expected behavior.On investigation, it seems to me that the problem begins during the creation of the
Environment
type variables for the two cases (s1
andi2
), which are either created empty (SetVar
) or are initially created assuming the first value of the domain (IntVar
) unlike bounded domain variables. Later, withhardReset
, this state of inconsistency will be returned, making it impossible to use the mechanism in this context.It seems to me that some treatments could be used to solve this problem:
Modify the creation of variables in the
Environment
:SetVar
and enumeratedIntVar
could be initialized with the full domain to avoid inconsistencies;Prevent the return to an incorrect state during the
hardReset
.I also tried inserting a new state into the search tree with
worldPush()
, but the behavior remained inconsistent. Are there any suggestions or possible solutions for dealing with this incorrect behavior? It seems to me that only by modifying the shock can this problem be solved.Beta Was this translation helpful? Give feedback.
All reactions