# Enumerating all possible solutions of Knapsack problem

**URL:** <https://discourse.julialang.org/t/enumerating-all-possible-solutions-of-knapsack-problem/61800>\
**Category:** Optimization (Mathematical)\
**Created:** [May 25, 2021, 5:42pm UTC](https://discourse.julialang.org/t/enumerating-all-possible-solutions-of-knapsack-problem/61800 "2021-05-25T17:42:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [May 25, 2021, 8:03pm UTC](https://discourse.julialang.org/t/enumerating-all-possible-solutions-of-knapsack-problem/61800/2 "2021-05-25T20:03:57Z")

</div>

> all possible solutions

All possible _optimal_ solutions?

This came up a few days ago:

> [@Right solver for JuMP to find every solution of a linear system of equations with integer solutions](https://discourse.julialang.org/t/right-solver-for-jump-to-find-every-solution-of-a-linear-system-of-equations-with-integer-solutions/44709/22):
>
> No problem. While it’s fresh in my mind, here is a more general solution for future reference: ## Packages using JuMP using Gurobi function example\_big\_sum(rowsum, colsum; verbose::Bool = true) ## Model: model = Model(Gurobi.Optimizer) @assert length(rowsum) == length(colsum) N = length(rowsum) INDEX = 1:N @variable(model, y[INDEX,INDEX] \>= 0, Int) @constraint(model, rowCons[i=INDEX], sum(y[i,j] for j in INDEX) == rowsum[i]) @constraint(model, colCons[j=INDEX…

See the JuMP documentation:

> **[Solutions · JuMP](https://jump.dev/JuMP.jl/stable/manual/solutions/#Multiple-solutions)**
>
> Documentation for JuMP.

---

_[View the full topic](https://discourse.julialang.org/t/enumerating-all-possible-solutions-of-knapsack-problem/61800)._
