import * as React from 'react'; import { Helmet } from 'react-helmet' import { createRoot } from 'react-dom/client'; import Container from '@mui/material/Container'; import Link from '@mui/material/Link'; import Box from '@mui/material/Box'; import Stack from '@mui/joy/Stack'; import Highlight from "react-highlight.js"; import ReactGA from "react-ga4"; import './style.css'; ReactGA.initialize("G-GL0P9YL3TE"); ReactGA.send("pageview"); const colabpath = 'https://colab.research.google.com/github/europeanplaice/subset_sum/blob/main/python/python_subset_sum.ipynb' let container = document.createElement('div'); container.id = 'app'; let body = document.querySelector('body'); body.appendChild(container); const root = createRoot(container); function HeaderBlock() { return (
) } function App() { return (
dpss | Python, Rust and WebApp to solve subset sum problem
Here is an online subset sum solver.
Here is a Google Colab Notebook subset sum solver.
This library is a Rust implementation of an algorithm that solves subset sum problem. It is available for both Python and Rust.

What is subset sum problem?

Solving subset sum problem means finding a list that sums to a particular value. Assuming there is a list of integers (such as [1, 2, 3, 6, -9, 11]), and another integer (such as 6), subset sum problem is the question to answer the subsets that sum to the specified integer. In this case, the answer is [1, 2, 3] and [-9, 1, 3, 11].

For detail information of subset sum problem, please refer to https://en.wikipedia.org/wiki/Subset_sum_problem

What is DPSS?

DPSS provides a tool to solve this problem without any specialized math knowledge. This can be used when you know how to get ALL the different solution that adds up to the same total.

It also offers a method to solve multiple subset sum problem. For example, if you are a travel planner, and you have to allocate families to some cars, you can count on this tool to make a plan of allocation. Given each member of the family are [2, 3, 2, 4, 5, 3, 2] and the capacities of each car are [4, 5, 8, 4], you can allocate the families to the cars as follows:

pattern 1 => [((4) -> [4] == [4]) ((4) -> [2 + 2] == [4]) ((5) -> [2 + 3] == [5]) ((8) -> [3 + 5] == [8])], pattern 2 => [((4) -> [4] == [4]) ((5) -> [5] == [5]) ((4) -> [2 + 2] == [4]) ((8) -> [2 + 3 + 3] == [8])]

And there are some questions posted on stackoverflow that can be sorted out by this tool. The questions are...

  • Algorithm to find which number in a list sum up to a certain number
  • Multiple subset sum calculation
  • Subset Sum algorithm

How to use DPSS?

The easiest way to use this tool is the Google Colab Notebook that I made. I also explain the other ways in https://github.com/europeanplaice/subset_sum .

Or, there is a WebAssenbly implementation.

What are the applications of subset sum problem and this tool?

This tool can be used in bank reconciliation. Here is a Google Colab Notebook that shows the example of the usage of DPSS in bank reconciliation. Inside of this example, a function of solving multiple subset sum problem is used.

) } root.render()