Skip to content

Commit

Permalink
Solved silly error but still unfeasible
Browse files Browse the repository at this point in the history
  • Loading branch information
davidusb-geek committed Jun 1, 2024
1 parent 7795aaa commit 20b9d60
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/emhass/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,27 +333,27 @@ def create_matrix(input_list, n):
matrix.append(row[:n*2])
return matrix
matrix = create_matrix(power_sequence, n-sequence_length)
y = plp.LpVariable.dicts("y", (i for i in range(len(matrix))), cat='Binary')
y = plp.LpVariable.dicts(f"y{k}", (i for i in range(len(matrix))), cat='Binary')
constraints.update({f"SingleValueConstraint_{i}" :
plp.LpConstraint(
e = plp.lpSum(y[i] for i in range(len(matrix))) - 1,
sense = plp.LpConstraintEQ,
rhs = 0)
})
constraints.update({f"DefSumConstraint_{i}" :
plp.LpConstraint(
e = plp.lpSum(P_deferrable[k][i] for i in set_I) - np.sum(power_sequence),
sense = plp.LpConstraintEQ,
rhs = 0)
})
constraints.update({f"DefPositiveConstraint_{i}" :
# constraints.update({f"pdef{k}_sumconstraint_{i}" :
# plp.LpConstraint(
# e = plp.lpSum(P_deferrable[k][i] for i in set_I) - np.sum(power_sequence),
# sense = plp.LpConstraintEQ,
# rhs = 0)
# })
constraints.update({f"pdef{k}_positiveconstraint_{i}" :
plp.LpConstraint(
e = P_deferrable[k][i],
sense = plp.LpConstraintGE,
rhs = 0)
for i in set_I})
for num, mat in enumerate(matrix):
constraints.update({f"ValueConstraint_{num}_{i}" :
constraints.update({f"pdef{k}_valueconstraint_{num}_{i}" :
plp.LpConstraint(
e = P_deferrable[k][i] - mat[i]*y[num],
sense = plp.LpConstraintEQ,
Expand Down

0 comments on commit 20b9d60

Please sign in to comment.