Can someone tell why my AddMaxEquality function not working?
#91 utility numbers for a grid of 3 by 3, for each origin cell to destination cell, so total 81 utility numbers
a = np.random.randint(0, 10, size=(9,9))
model = cp_model.CpModel()
#each cell in grid is either 0 or 1
cell_binary = [model.NewBoolVar("Cell_" + str(i)) for i in range(9)]
model.Add(sum(cell_binary) == 2)
#list of list of utility numbers for all cells
utilities = [
[
model.AddProdEquality(
model.NewIntVar(0, 100, “j”),
[a[o, d], cell_binary[o]],
)
for o in range(9)
]
for d in range(9)
]
#find max utility
utility_max = [
model.AddMaxEquality(model.NewIntVar(0, 10, "a"), i)
for i in utilities
]
--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/e320f746-f1d4-4d60-978c-b4cf3da72d85%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/fdace77b-0e9e-4a08-bc73-b9a3fbf868a8%40googlegroups.com.