NSP - Github Solution Query
Hi,
In the github solution for NSP the Hard shift constraint is formulated as follows:
lagrange_hard_shift * sum_d ((sum_n(effort * q_i(n,d)) - workforce) ** 2)
this is in the form of (a-b)**2.
Later in the example post expanding and merging this formula becomes
lagrange_hard_shift * (effort ** 2 - 2 effort * workforce) * sum_d sum_n q_i(n,d) + lagrange_hard_shift * effort ** 2 * sum_d sum_m sum_n q_i(n,d) q_j(m, d)
I have not understood how this was derived. (Query #1)
Moreover in the off-diagonal loop, 2 is multiplied with lagrange_hard_shift * effort ** 2. Where did this 2 come from? (Query #2)
Can you please help with queries 1 and 2?
Comments
got it..I was doing the squaring of summation wrong. Thanks.
Please sign in to leave a comment.