Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.184.152 Times

Algorithm::Knapsack 0.02

  Date Added: October 17, 2010  |  Visits: 2.248

Algorithm::Knapsack

Report Broken Link
Printer Friendly Version


Product Homepage
Download (203 downloads)



Algorithm::Knapsack is a brute-force algorithm for the knapsack problem. SYNOPSIS use Algorithm::Knapsack; my $knapsack = Algorithm::Knapsack->new( capacity => $capacity, weights => @weights, ); $knapsack->compute(); foreach my $solution ($knapsack->solutions()) { foreach my $index (@{$solution}) { # do something with $weights[$index] } } The knapsack problem asks, given a set of items of various weights, find a subset or subsets of items such that their total weight is no larger than some given capacity but as large as possible. This module solves a special case of the 0-1 knapsack problem when the value of each item is equal to its weight. Capacity and weights are restricted to positive integers. METHODS new my $knapsack = Algorithm::Knapsack->new( capacity => $capacity, weights => @weights, ); Creates a new Algorith::Knapsack object. Value of $capacity is a positive integer and @weights is a reference to an array of positive integers, each of which is less than $capacity. compute $knapsack->compute(); Iterates over all possible combinations of weights to solve the knapsack problem. Note that the time to solve the problem grows exponentially with respect to the number of items (weights) to choose from. solutions my @solutions = $knapsack->solutions(); Returns a list of solutions. Each solution is a reference to an array of indexes to @weights..

Requirements: No special requirements
Platforms: Linux
Keyword: Algorithm Algorithmknapsack Capacity Knapsack Knapsack Problem Libraries Problem Programming Solutions Weights
Users rating: 0/10

License: Freeware Size: 4.1 KB
USER REVIEWS
More Reviews or Write Review


ALGORITHM::KNAPSACK RELATED
Development Tools  -  LAPJV - Jonker-Volgenant Algorithm for Linear Assignment Problem 1.0
The Jonker-Volgenant algorithm is much faster than the famous Hungarian algorithm for the Linear Assignment Problem (LAP). This Matlab implementation is modified from the original C++ code made by Roy Jonker, one of the inventors of the algorithm....
10 KB  
Development Tools  -  Greedy algorithm for Set Cover problem 1.0
This function contains the well known greedy algorithm for solving Set Cover problem (ChvdodAtal, 1979), with two small modifications:* In case of more than one possible choice at a certain step, the biggest set is chosen;* Once the solution is...
10 KB  
Development Tools  -  Nearest Neighbor algorithm for the Travelling Salesman Problem 1.0
The 2-column vector contains cities' coordinates. The algorithm generates the optimal path to visit all the cities exactly once, and return to the starting city.The algorithm has its limitations, and based on the cities' distribution on the map it...
10 KB  
Development Tools  -  Munkres Assignment Algorithm 1.0
Munkres algorithm (also known as Hungarian algorithm) is an efficient algorithm to solve the assignment problem in polynomial-time. The algorithm has many applications in combinatorial optimization, for example in Traveling Salesman problem.There...
10 KB  
Libraries  -  Algorithm::Diff::Apply 0.2.3
Algorithm::Diff::Apply is a Perl module to apply one or more Algorithm::Diff diffs. SYNOPSIS ## Single-diff form: use Algorithm::Diff::Apply qw{apply_diff}; my @ary = ...; my @diff = ...; # some call to Algorithm::Diff::diff() my...
12.29 KB  
Development Tools  -  Low-Thrust Orbital Transfer with Solar-Electric Propulsion 1.0
This interactive MATLAB script (sep_ltot.m) can be used to determine the characteristics of continuous, low-thrust orbital transfer between two nonplanar circular orbits using solar-electric propulsion (SEP). The numerical method used in this...
51.2 KB  
Development Tools  -  SpeedyGA: A Fast Simple Genetic Algorithm 1.0
SpeedyGA is a vectorized implementation of a genetic algorithm in the Matlab programming language. Without bells and whistles, it faithfully implements the specification for a Simple GA given on pgs 10, 11 of M. Mitchell's GA book. See comments in...
10 KB  
Development Tools  -  Application of Optimization to the Study of Chemical Processes 1.0
The five programs provided solve several process design problems. These examples were originally provided as applications of process design optimization by Edgar, Himmelblau and Lasdon in their excellent book entitled Optimization of Chemical...
10 KB  
Development Tools  -  THE FASTEST WAY TO SORT N NUMBERS: sortN library 1.0
Have you ever thought about the fastest way to sort N numbers?Last week I wrote a post about the fastest way to sort 3 numbers, this week I show you a tricky way to optimize the sort of N numbers.The problem of sorting an array of numbers is...
10 KB  
Libraries  -  Text::Diff3::DiffHeckel 0.06
Text::Diff3::DiffHeckel is a two-way diff plug-in. SYNOPSIS use Text::Diff3; my $f = Text::Diff3::Factory->new; my $p = $f->create_diff; my $mytext = $f->create_text([ map{chomp;$_} ]); my $original = $f->create_text([ map{chomp;$_}...
11.26 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB  
Libraries  -  wolfSSL 4.0.0
The wolfSSL embedded SSL/TLS library is a lightweight SSL library written in ANSI standard C and targeted for embedded and RTOS environments - primarily because of its small size, speed, and feature set. It is commonly used in standard operating...
3.88 MB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB