Skip to content

Commit be8c383

Browse files
committed
fix: AFHMM+SAC: add safeguard for when the optimizer does not find any constraint and returns None.
Fixes: #40
1 parent 04b64d7 commit be8c383

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

nilmtk_contrib/disaggregate/afhmm_sac.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,11 @@ def disaggregate_thread(self, test_mains,index,d):
209209
u = time.time()
210210
prob = cvx.Problem(expression, constraints)
211211
prob.solve(solver=cvx.SCS,verbose=False, warm_start=True)
212-
s_ = [i.value for i in cvx_state_vectors]
212+
s_ = [
213+
np.zeros((len(test_mains), self.default_num_states)) if i.value is None
214+
else i.value
215+
for i in cvx_state_vectors
216+
]
213217

214218
prediction_dict = {}
215219
for appliance_id in range(self.num_appliances):

0 commit comments

Comments
 (0)