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
.filter(_._1.forall(_ >=0)) // all main vals must be non-negative
241
-
.map((s1, s2) => s1.sum + s2.sum)
242
-
.head
243
-
valchoices= (0 to bound.toInt).iterator.flatMap(helper0(_, freeVars.size))
237
+
valbound= freeVars.map(maxVals).sum
238
+
valchoices= (0 to bound).iterator.flatMap(helper0(_, freeVars.map(maxVals).toList))
244
239
245
240
valanswer=
246
241
choices
247
242
.map(freeVals => (eval(freeVals), freeVals))
248
-
//.take(1000) // TODO: when to stop?
249
-
//.tapEach(println)
250
-
.filter(_._1.forall(_ >=0)) // all main vals must be non-negative
243
+
.filter(p => p._1.forall(_ >=0) && (p._1 lazyZip mainVars).forall((a, b) => a <= maxVals(b))) // all main vals must be non-negative, but at most their max
251
244
.map((s1, s2) => s1.sum + s2.sum)
252
-
.min// TODO: wrong, freeVals sum is minimal, but mainVals sum isn't
0 commit comments