ratio.

Find a tool

Browse all tools and categories ↗
KNAPSACK BUDGET OPTIMIZER

Knapsack Budget Optimizer

Select a maximum-value subset of indivisible items under a whole-number capacity limit.

Enter your values

01 / INPUT
Calculated on your device

YOUR CALCULATION

Result

—

Calculation steps

Work through one step at a time or reveal the complete calculation. The steps use your current inputs.

    How to calculate

    Use exact zero-or-one dynamic programming so each item can be included at most once.

    DP[i,c]=max(DP[i−1,c],value[i]+DP[i−1,c−weight[i]])

    Worked example

    Weights 2,3,4 with values 4,5,6 and capacity 5 select the first two items, value 9 and used capacity 5.

    Assumptions and input details

    Whole capacity up to 10000 and at most 100 items; weights share the capacity unit and values share a separate objective unit. No fractions, repeated item copies, multiple resources or actual purchase execution. Equal-value solutions keep the earlier exclusion convention.

    Using this calculator

    Can I enter my own problem?

    Yes. Replace the example values with your own inputs. The result, calculation steps, tables and applicable diagrams update from those inputs. Blank or invalid values clear the result; example values are never silently substituted for missing inputs.

    Are the results exact?

    Results use floating-point arithmetic and displayed rounding. Read the formula, assumptions and any stated data precision before interpreting the result.

    Is my input uploaded?

    The calculation runs in your browser. No account, file upload or external AI service is required. Inputs are not saved between page reloads.

    RELATED TOOL · PLANNINGTwo Product Resource Mix Optimizer

    Maximize an entered linear contribution from two continuously divisible products under shared resource capacities.

    RELATED TOOL · PLANNINGLinear Stock Cutting Allocation Calculator

    Find a minimum identical-stock allocation under an explicit per-piece kerf reservation and end-trim convention.

    RELATED TOOL · MINIMUM COST ASSIGNMENTMinimum Cost Assignment Calculator

    Assign every worker to one distinct task at minimum total entered cost using a rectangular cost matrix.

    ADVERTISEMENT

    Reserved advertising space.