Skip to content

Commit ffcc2a6

Browse files
committed
fix gh1161 by creating copy correctly
1 parent aa92b65 commit ffcc2a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

control/optimal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,9 @@ def _compute_states_inputs(self, coeffs):
746746
states = self.last_states
747747
else:
748748
states = self._simulate_states(self.x, inputs)
749-
self.last_x = self.x
750-
self.last_states = states
751-
self.last_coeffs = coeffs
749+
self.last_x = self.x.copy() # save initial state
750+
self.last_states = states # always a new object
751+
self.last_coeffs = coeffs.copy() # save coefficients
752752

753753
return states, inputs
754754

0 commit comments

Comments
 (0)