You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this fantastic package first of all!
I just started evaluating it for a project where so far I used Gurobi.
The axis argument on the sum method was very useful for me there, e.g. in case where assignment[b,t,m] was the assignment of a batch to a certain machine for a certain task. So far I modelled the constraint to ensure that each batch was assigned to at most one machine per task as assignment.sum(axis=-1)<=1 or the capacity constraints on each machine as assignment.sum(axis=(0,1))<=capacity.
Hence I'd love to see the axis argument implemented for the sum method.
Until then: What is the recommended workaround? Am I overlooking anything?
Kind regards,
The text was updated successfully, but these errors were encountered:
This is certainly on our wishlist to implement the axis argument for all operators (not only sum).
We started a shortlist for operators in issue #117, if you have any suggestions, please feel free to post them there.
A workaround you can use until then is something similar to this:
fromcpmpyimport*assignment=intvar(0,10,shape=(3,4,5), name="assignment")
capacity=intvar(0,100, shape=5, name="capacity")
# each batch is assigned to at most one machine per taskmodel+=cpm_array([assignment[i,j,:].sum() foriinrange(3) forjinrange(4)]) <=1# or equivalently:foriinrange(3):
forjinrange(4):
model+=assignment[i,j,:].sum() <=1# capacity constraints on each machine:model+= [assignment[:,:,m].sum() forminrange(5)] <=capacity
Hi!
Thanks for this fantastic package first of all!
I just started evaluating it for a project where so far I used Gurobi.
The axis argument on the sum method was very useful for me there, e.g. in case where assignment[b,t,m] was the assignment of a batch to a certain machine for a certain task. So far I modelled the constraint to ensure that each batch was assigned to at most one machine per task as
assignment.sum(axis=-1)<=1
or the capacity constraints on each machine asassignment.sum(axis=(0,1))<=capacity
.Hence I'd love to see the axis argument implemented for the sum method.
Until then: What is the recommended workaround? Am I overlooking anything?
Kind regards,
The text was updated successfully, but these errors were encountered: