SUBSET_SUM_TASKS
Solve a Subset Sum Problem using Multiple Tasks


SUBSET_SUM_TASKS is a directory which illustrates how a subset sum problem can be solved by dividing it into a number of tasks, and then having each task executed independently.

In task computing, a problem is broken down into subproblems, each of which can be solved separately, simultaneously or sequentially.

MATLAB implements task computing by having the user define a "job" which in turn is composed of several "tasks". Each task is carried out by calling a MATLAB function with specific arguments, and the tasks are carried out in some order, over some set of processors, when the job is submitted for execution.

In the subset sum problem, we are given a collection of (21) weights and a target value (24639098). We are to decide which combination(s) of weights yield a sum equal to the target value.

The program subset_sum_job_local.m is responsible for solving the problem. It does this by breaking it down into four smaller problems, defining each subproblem as a task. The program subset_sum_task.m carries out any one of these tasks, by looping through a range of possible weight combinations and reporting the weight labels and values that achieve the required sum.

The program subset_sum_job_local.m executes the tasks on the local machine. With only a small change, the program subset_sum_job_ithaca.m runs the tasks on the Ithaca cluster. The program subset_sum_fsu.m runs the tasks on FSU's HPC cluster.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

SUBSET_SUM_TASKS is available in a MATLAB version.

Related Data and Programs:

BIRTHDAY_REMOTE, a MATLAB program which runs a Monte Carlo simulation of the birthday paradox, and includes instructions on how to run the job, via MATLAB's BATCH facility, on a remote system such as Virginia Tech's ITHACA cluster.

CELL_DETECTION_TASKS, a MATLAB program which creates modified versions of a sequence of gray-scale TIF files containing images of cells; the process of each file is carried out independently, using the "task" feature of MATLAB's parallel computing toolbox.

CG_DISTRIBUTED, a MATLAB program which implements a version of the NAS CG conjugate gradient benchmark, using distributed memory.

COLLATZ_PARFOR, a MATLAB program which seeks the maximum Collatz sequence between 1 and N, running in parallel using MATLAB's "PARFOR" feature.

COLOR_REMOTE, a MATLAB program which carries out the color segmentation of an image in parallel, via SPMD commands; this includes instructions on how to run the job, via MATLAB's BATCH facility, on a remote system such as Virginia Tech's ITHACA cluster.

CONTRAST_SPMD, a MATLAB program which demonstrates the SPMD parallel programming feature for image operations; the client reads an image, the workers increase contrast over separate portions, and the client assembles and displays the results.

CONTRAST2_SPMD, a MATLAB program which demonstrates the SPMD parallel programming feature for image operations; this improves the contrast_spmd program by allowing the workers to share some data; this makes it possible to eliminate artificial "seams" in the processed image.

FD2D_HEAT_EXPLICIT_SPMD, a MATLAB program which uses the finite difference method and explicit time stepping to solve the time dependent heat equation in 2D. A black and white image is used as the "initial condition". MATLAB's SPMD facility is used to carry out the computation in parallel.

FMINCON_PARALLEL, a MATLAB program which demonstrates the use of MATLAB's FMINCON constrained minimization function, taking advantage of MATLAB's Parallel Computing Toolbox for faster execution.

IMAGE_DENOISE_SPMD, a MATLAB program which demonstrates the SPMD parallel programming feature for image operations; the client reads an image, the workers process portions of it, and the client assembles and displays the results.

LINEAR_SOLVE_DISTRIBUTED, a MATLAB program which solves a linear system A*x=b using MATLAB's spmd facility, so that the matrix A is "distributed" across multiple MATLAB workers.

LYRICS_REMOTE, a MATLAB program which runs in parallel, using three workers which cooperate "systolically", that is, as through they were on an assembly line. The output from worker 1 is passed to worker 2 for further processing, and so on. This includes instructions on how to run the job, via MATLAB's BATCH facility, on a remote system such as Virginia Tech's ITHACA cluster.

MATLAB_COMMANDLINE, MATLAB programs which illustrate how MATLAB can be run from the UNIX command line, that is, not with the usual MATLAB command window.

MATLAB_DISTCOMP, a MATLAB program which remotely runs a set of 5 jobs on the Ithaca cluster. These jobs are equivalent to the BIRTHDAY_REMOTE, COLOR_REMOTE, subset_sum_tasks, LYRICS_REMOTE and MD_REMOTE jobs.

MATLAB_PARALLEL, MATLAB programs which illustrate "local" parallel programming on a single computer with MATLAB's Parallel Computing Toolbox.

MATLAB_REMOTE, MATLAB programs which illustrate the use of remote job execution, in which a desktop copy of MATLAB sends programs and data to a remote machine for execution. Included is information needed to properly configure the local machine.

MD_PARFOR, a MATLAB program which carries out a molecular dynamics simulation, running in parallel using MATLAB's "PARFOR" feature.

ODE_SWEEP_PARFOR, a MATLAB program which demonstrates how the PARFOR command can be used to parallelize the computation of a grid of solutions to a parameterized system of ODE's.

PLOT_SPMD, a MATLAB library which demonstrates the SPMD parallel programming feature, by having a number of labs compute parts of a sine plot, which is then displayed by the client process.

PRIME_PARFOR, a MATLAB program which counts the number of primes between 1 and N; running in parallel using MATLAB's "PARFOR" feature.

PRIME_SPMD, a MATLAB program which counts the number of primes between 1 and N; running in parallel using MATLAB's "SPMD" feature.

QUAD_PARFOR, a MATLAB program which estimates an integral using quadrature; running in parallel using MATLAB's "PARFOR" feature.

QUAD_SPMD, a MATLAB program which estimates an integral using quadrature; running in parallel using MATLAB's "SPMD" feature.

QUAD_TASKS, a MATLAB program which estimates an integral using quadrature; running in parallel using MATLAB's "TASK" feature.

RANDOM_WALK_2D_AVOID_TASKS, a MATLAB program which computes many self avoiding random walks in 2D by creating a job which defines each walk as a task, and then computes these independently using MATLAB's Parallel Computing Toolbox task computing capability.

SATISFY_PARFOR, a MATLAB program which demonstrates, for a particular circuit, an exhaustive search for solutions of the circuit satisfiability problem, running in parallel using MATLAB's "PARFOR" feature.

SUBSET_SUM, a MATLAB library which seeks solutions of the subset sum problem.

SUBSET_SUM_SERIAL, a MATLAB program which seeks solutions of the subset sum problem, in which it is desired to find a subset of a set of integers which has a given sum; this version of the program is intended as a starting point for a parallel approach.

Reference:

The User's Guide for the Parallel Computing Toolbox is available at http://www.mathworks.com/access/helpdesk/help/pdf_doc/distcomp/distcomp.pdf

Source Code:

You can go up one level to the MATLAB source codes.


Last revised on 10 May 2012.