backtracking algorithm
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 787
Robsort Sorting Algorithm 1.0
Robsort Sorting Algorithm is a sorting algorithm which uses random numbers. more>>
Robsort in a GNU public license sorting algorithm devleloped by Robert Thompson. Robsort uses random number generation to sort arrays of integers. It is claimed to be the worlds least efficient sorting algorithm.
Scientists have calculated the robsort algorithm to approach an order of [n!] (n factorial) inefficiency, however this inefficiency could only theoretically be obtained by using truly random numbers.
<<lessScientists have calculated the robsort algorithm to approach an order of [n!] (n factorial) inefficiency, however this inefficiency could only theoretically be obtained by using truly random numbers.
Download (0.10MB)
Added: 2005-06-06 License: GPL (GNU General Public License) Price:
1601 downloads
Fast Genetic Algorithm 1.3.4
Fast Genetic Algorithm is a simple yet powerful implementation of a general genetic algorithm. more>>
Fast Genetic Algorithm is a simple yet powerful implementation of a general genetic algorithm, and provides many types of crossover and selection procedures.
It is suitable to solve mathematical problems such as combinatorical optimization ones, as well as to build artificial life simulations.
Written in C++, the library is released under the terms of the GNU Lesser General Public License, and its easy to incorporate in other applications.
Further improvements include parallelization of the algorithm in multi-processor environments and general performance optimizations.
You can download the current development snapshot, which is a working but not fully tested version of the library.
Enhancements:
- Dynamic arrays were fixed to compile even on non-C99 compilers (like MSVC).
- A switch to choose whether to preserve the fittest individual across generations was added.
- The pthreads-win32 library was included in the package, as well as Visual C++ and Dev-C++ projects to easily build the source code on Windows.
- A function that computes the standard deviation of fitness values was added (thanks to Jonas Neubert for the contribution).
<<lessIt is suitable to solve mathematical problems such as combinatorical optimization ones, as well as to build artificial life simulations.
Written in C++, the library is released under the terms of the GNU Lesser General Public License, and its easy to incorporate in other applications.
Further improvements include parallelization of the algorithm in multi-processor environments and general performance optimizations.
You can download the current development snapshot, which is a working but not fully tested version of the library.
Enhancements:
- Dynamic arrays were fixed to compile even on non-C99 compilers (like MSVC).
- A switch to choose whether to preserve the fittest individual across generations was added.
- The pthreads-win32 library was included in the package, as well as Visual C++ and Dev-C++ projects to easily build the source code on Windows.
- A function that computes the standard deviation of fitness values was added (thanks to Jonas Neubert for the contribution).
Download (0.22MB)
Added: 2007-07-16 License: LGPL (GNU Lesser General Public License) Price:
835 downloads
mcl-algorithm 06-021
mcl-algorithm is a scalable cluster algorithm for graphs based on stochastic flow. more>>
mcl-algorithm is a scalable cluster algorithm for graphs based on stochastic flow.
The flow process employed by the algorithm is mathematically sound and intrinsically tied to cluster structure in graphs, which is revealed as the imprint left by the process.
The threaded implementation has handled graphs of up to one million nodes within hours, and is widely used in the field of protein family analysis. It comes with a wide range of sibling utilities for handling and analyzing graphs, matrices, and clusterings.
The MCL algorithm simulates flow using (alternating) two simple algebraic operations on matrices. Its formulation is simple and elegant. There are no high-level procedural instructions for assembling, joining, or splitting of groups - cluster structure is bootstrapped via a flow process that is inherently affected by any cluster structure present.
The first operation used by MCL is expansion, which coincides with normal matrix multiplication. Expansion models the spreading out of flow, it becoming more homogeneous. The second is inflation, which is mathematically speaking a Hadamard power followed by a diagonal scaling. Inflation models the contraction of flow, it becoming thicker in regions of higher current and thinner in regions of lower current. The MCL process causes flow to spread out within natural clusters and evaporate inbetween different clusters.
- By varying parameters, clusterings on different scales of granularity can be found. The number of clusters can not and need not be specified in advance, but the algorithm can be adapted to different contexts.
- The issue how many clusters? is not dealt with in an arbitrary manner, but rather by strong internal logic. Cluster structure leaves its marks on the flow process simulated by the algorithm, and the flow parameters control the granularity of the cluster imprint.
- The limit of the MCL process (the process simulated by the algorithm) is in general extremely sparse, and the iterands are sparse in a weighted sense. This gives the means to scale the algorithm drastically, leading to a worst-case complexity of order Nk^2, where N is the number of nodes of the input graph, and where k is a threshold for the number of resources allocated per node.
- The rate of convergence of the MCL process, and projection of the iterands afterwards onto the resulting clustering, give hooks for unsupervised parameter adjustment.
- The iterands of the MCL process have structural properties which allow a cluster interpretation, and which generalize the mapping of MCL limits onto clusterings. The mathematics associated with the MCL process shows that there is an intrinsic relationship between the MCL process and cluster structure in graphs. This is very valuable given the many heuristic approaches in cluster analysis.
Enhancements:
- Numerous cleanups in much of the code.
- Improvements in caching intermediate results.
<<lessThe flow process employed by the algorithm is mathematically sound and intrinsically tied to cluster structure in graphs, which is revealed as the imprint left by the process.
The threaded implementation has handled graphs of up to one million nodes within hours, and is widely used in the field of protein family analysis. It comes with a wide range of sibling utilities for handling and analyzing graphs, matrices, and clusterings.
The MCL algorithm simulates flow using (alternating) two simple algebraic operations on matrices. Its formulation is simple and elegant. There are no high-level procedural instructions for assembling, joining, or splitting of groups - cluster structure is bootstrapped via a flow process that is inherently affected by any cluster structure present.
The first operation used by MCL is expansion, which coincides with normal matrix multiplication. Expansion models the spreading out of flow, it becoming more homogeneous. The second is inflation, which is mathematically speaking a Hadamard power followed by a diagonal scaling. Inflation models the contraction of flow, it becoming thicker in regions of higher current and thinner in regions of lower current. The MCL process causes flow to spread out within natural clusters and evaporate inbetween different clusters.
- By varying parameters, clusterings on different scales of granularity can be found. The number of clusters can not and need not be specified in advance, but the algorithm can be adapted to different contexts.
- The issue how many clusters? is not dealt with in an arbitrary manner, but rather by strong internal logic. Cluster structure leaves its marks on the flow process simulated by the algorithm, and the flow parameters control the granularity of the cluster imprint.
- The limit of the MCL process (the process simulated by the algorithm) is in general extremely sparse, and the iterands are sparse in a weighted sense. This gives the means to scale the algorithm drastically, leading to a worst-case complexity of order Nk^2, where N is the number of nodes of the input graph, and where k is a threshold for the number of resources allocated per node.
- The rate of convergence of the MCL process, and projection of the iterands afterwards onto the resulting clustering, give hooks for unsupervised parameter adjustment.
- The iterands of the MCL process have structural properties which allow a cluster interpretation, and which generalize the mapping of MCL limits onto clusterings. The mathematics associated with the MCL process shows that there is an intrinsic relationship between the MCL process and cluster structure in graphs. This is very valuable given the many heuristic approaches in cluster analysis.
Enhancements:
- Numerous cleanups in much of the code.
- Improvements in caching intermediate results.
Download (1.1MB)
Added: 2006-01-24 License: GPL (GNU General Public License) Price:
1370 downloads
Optimization Algorithm Toolkit 1.3
Optimization Algorithm Toolkit is a workbench and toolkit for developing, evaluating, and playing with optimization algorithms. more>>
Optimization Algorithm Toolkit is a workbench and toolkit for developing, evaluating, and playing with classical and state-of-the-art optimization algorithms on standard benchmark problem domains; including reference algorithm implementations, graphing, visualizations and much more. The project was developed initially by Jason Brownlee as a part of his Ph.D. program.
The goal of this project is to deliver obscure-and-prevalent, old-and-new optimization algorithms from research literature to both research scientists and algorithm practitioners alike. Algorithms include biologically inspired approaches such as evolutionary algorithms (genetic algorithms), swarm algorithms (ants and particle swarm), and immune system algorithms.
Also included are more conventional approaches such as approaches inspired by physics including simulated annealing and extremal optimization. Problem domains include numerical function optimization, traveling salesman problems, and protein folding all with many standard benchmark instances taken from research literature.
A user-friendly graphical interface is provided to rapidly evaluate and compare algorithm and problem configurations, visualize algorithm behavior, and graph algorithm performance over time. A robust, modular, and extensible framework underlies the platform to facilitate the easy addition and modification of algorithms, addition of new problem domains and problem instances as well as facilitate more advanced algorithm experimentation.
The algorithm implementations are extensible and easily support modification and applicaition to varied problem domains. Please report any bugs, feature requests or include your own algorithms by accessing the services on the project home website. This is an open source project (released under the GPL) so the source code is available. The project was compiled with Java 1.5 (update 9).
Enhancements:
- This release includes many framework and graphical interface fixes, as well as a few new algorithms to play with.
<<lessThe goal of this project is to deliver obscure-and-prevalent, old-and-new optimization algorithms from research literature to both research scientists and algorithm practitioners alike. Algorithms include biologically inspired approaches such as evolutionary algorithms (genetic algorithms), swarm algorithms (ants and particle swarm), and immune system algorithms.
Also included are more conventional approaches such as approaches inspired by physics including simulated annealing and extremal optimization. Problem domains include numerical function optimization, traveling salesman problems, and protein folding all with many standard benchmark instances taken from research literature.
A user-friendly graphical interface is provided to rapidly evaluate and compare algorithm and problem configurations, visualize algorithm behavior, and graph algorithm performance over time. A robust, modular, and extensible framework underlies the platform to facilitate the easy addition and modification of algorithms, addition of new problem domains and problem instances as well as facilitate more advanced algorithm experimentation.
The algorithm implementations are extensible and easily support modification and applicaition to varied problem domains. Please report any bugs, feature requests or include your own algorithms by accessing the services on the project home website. This is an open source project (released under the GPL) so the source code is available. The project was compiled with Java 1.5 (update 9).
Enhancements:
- This release includes many framework and graphical interface fixes, as well as a few new algorithms to play with.
Download (6.5MB)
Added: 2007-07-14 License: GPL (GNU General Public License) Price:
843 downloads
Parallel Genetic Algorithm Library 0.99
Parallel Genetic Algorithm Library is a C++ toolkit for producing genetic algorithm code. more>>
Parallel Genetic Algorithm Library (or PGAL for short) is a C++ toolkit for simply, efficiently, and swiftly producing genetic algorithm code that works across multiple processors.
This is useful not only for those with multi-processor computers, but also for distributed and cluster computing genetic algorithm environments such as openMosix.
<<lessThis is useful not only for those with multi-processor computers, but also for distributed and cluster computing genetic algorithm environments such as openMosix.
Download (0.074MB)
Added: 2007-06-29 License: GPL (GNU General Public License) Price:
852 downloads
C Algorithms Library 1.0.0
C Algorithms Library is a collection of commonly used Computer Science algorithms. more>>
C Algorithms Library is a collection of commonly used Computer Science algorithms.
The focus is on code that is well documented and tested, portable, and reusable.
The C Programming Language has a much smaller standard library compared to other more modern programming languages such as Java or Python.
In particular, it lacks implementations of many common data structures and algorithms. This is a collection of such algorithms to attempt to alleviate this problem.
The source code is released under the Modified BSD license, and as such can be freely modified and reused in any project, either proprietary or free. It is written in 100% ANSI standard C.
Each algorithm is written to be independent from the other implementations, allowing particular algorithms to be included in projects as needed.
Data structures
Collections
ArrayList : Automatically resizing array.
Doubly linked list : A set of values stored in a list with links that point in both directions.
Singly linked list : A set of values stored in a list with links that point in one direction.
Queue : Double ended queue which can be used as a FIFO or a stack.
Set : Unordered set of values.
Mappings
Hash table : Collection of values which can be addressed using a key.
Trie : Fast mapping using strings as keys.
Binary search trees
AVL tree : Balanced binary search tree with O(log n) worst case performance.
Utility functions
All of the above data structures operate on void pointers. It is sometimes necessary to compare values (when sorting a list, for example) or generate a hash key (in a hash table or set). This is done by providing a pointer to a function which provides this functionality. The following functions provide this functionality for some common data types.
- Integer comparison and hash functions.
- String comparison and hash functions.
- Generic (void) pointer comparison and hash functions.
<<lessThe focus is on code that is well documented and tested, portable, and reusable.
The C Programming Language has a much smaller standard library compared to other more modern programming languages such as Java or Python.
In particular, it lacks implementations of many common data structures and algorithms. This is a collection of such algorithms to attempt to alleviate this problem.
The source code is released under the Modified BSD license, and as such can be freely modified and reused in any project, either proprietary or free. It is written in 100% ANSI standard C.
Each algorithm is written to be independent from the other implementations, allowing particular algorithms to be included in projects as needed.
Data structures
Collections
ArrayList : Automatically resizing array.
Doubly linked list : A set of values stored in a list with links that point in both directions.
Singly linked list : A set of values stored in a list with links that point in one direction.
Queue : Double ended queue which can be used as a FIFO or a stack.
Set : Unordered set of values.
Mappings
Hash table : Collection of values which can be addressed using a key.
Trie : Fast mapping using strings as keys.
Binary search trees
AVL tree : Balanced binary search tree with O(log n) worst case performance.
Utility functions
All of the above data structures operate on void pointers. It is sometimes necessary to compare values (when sorting a list, for example) or generate a hash key (in a hash table or set). This is done by providing a pointer to a function which provides this functionality. The following functions provide this functionality for some common data types.
- Integer comparison and hash functions.
- String comparison and hash functions.
- Generic (void) pointer comparison and hash functions.
Download (0.33MB)
Added: 2006-01-31 License: BSD License Price:
1376 downloads
Algorithm::C3 0.05
Algorithm::C3 is a module for merging hierarchies using the C3 algorithm. more>>
Algorithm::C3 is a module for merging hierarchies using the C3 algorithm.
SYNOPSIS
use Algorithm::C3;
# merging a classic diamond
# inheritence graph like this:
#
#
# /
#
# /
#
my @merged = Algorithm::C3::merge(
D,
sub {
# extract the ISA array
# from the package
no strict refs;
@{$_[0] . ::ISA};
}
);
print join ", " => @merged; # prints D, B, C, A
This module implements the C3 algorithm. I have broken this out into its own module because I found myself copying and pasting it way too often for various needs. Most of the uses I have for C3 revolve around class building and metamodels, but it could also be used for things like dependency resolution as well since it tends to do such a nice job of preserving local precendence orderings.
<<lessSYNOPSIS
use Algorithm::C3;
# merging a classic diamond
# inheritence graph like this:
#
#
# /
#
# /
#
my @merged = Algorithm::C3::merge(
D,
sub {
# extract the ISA array
# from the package
no strict refs;
@{$_[0] . ::ISA};
}
);
print join ", " => @merged; # prints D, B, C, A
This module implements the C3 algorithm. I have broken this out into its own module because I found myself copying and pasting it way too often for various needs. Most of the uses I have for C3 revolve around class building and metamodels, but it could also be used for things like dependency resolution as well since it tends to do such a nice job of preserving local precendence orderings.
Download (0.008MB)
Added: 2006-10-20 License: Perl Artistic License Price:
1099 downloads
IDS::Algorithm::MM 1.02
IDS::Algorithm::MM is a Perl module created to learn or test using a first-order Markov Model (MM). more>>
IDS::Algorithm::MM is a Perl module created to learn or test using a first-order Markov Model (MM).
SYNOPSIS
A usage synopsis would go here. Since it is not here, read on.
In section 4.2 in Kruegel and Vignas paper, they ignored the probability information that the MM provided, and produced a binary result. In effect, they were using the constructed MM as a {N,D}FA.
Someday more will be here.
Ideally, we would be using the algorithm from stolcke94bestfirst. Constructing a DFA rather than a NFA in effect has performed most of the state merging that stolcke93hidden do.
Consider also a java or C/C++ implementaion: http://www.ghmm.org/ http://www.run.montefiore.ulg.ac.be/~francois/software/jahmm/
Useful information: http://www.cs.brown.edu/research/ai/dynamics/tutorial/Documents/HiddenMarkovModels.html http://www.comp.leeds.ac.uk/roger/HiddenMarkovModels/html_dev/main.html L R Rabiner and B H Juang, `An introduction to HMMs, IEEE ASSP Magazine, 3, 4-16.
printvcg
printvcg(filehandle)
Print in a form usable by VCG for printing the DFA.
If the filehandle is specified, print there; otherwise, print to STDOUT.
This code was stolen from DFA, and does not know about the probabilities.
load(filehandle)
Load a MM from a file; this is the inverse of "print", and the format we expect is that used in $self->print.
test(tokensref, string, instance)
Test the string of tokens and calculate the probability of the string being seen. At each stage, we get a p in [0,1]. The result is the product of these probabilities.
Note that if a transition cannot be made, we return a 0 probability.
add(tokensref, string, instance)
The collection of tokens (in the list referenced by tokensref) is a complete example of a list that should be accepted by the DFA.
string and instance are IDS::Test framework arguments that we ignore because we do not need them.
WE add the transition from the last token to the (ACCEPT) state.
add_transition(from, token)
Add a transition from one state to another when the specified token is received. It is not an error to try to add an existing transition. In that event, this function quietly returns. If no such transition exists, we look for a transition on the token; if so, we add an edge to the destination node for the existing edge. Finally, if there is no other choice, we create a new state and add the edge.
generalize()
Reduce the number of states in the model.
Our building a DFA rather than a NFA has in effect performed most of the state merging that would have occurred.
XXX We should still be doing some checks for additional merge possibilities.
XXX A proof that the DFA is effectively the NFA with merged states would be useful.
<<lessSYNOPSIS
A usage synopsis would go here. Since it is not here, read on.
In section 4.2 in Kruegel and Vignas paper, they ignored the probability information that the MM provided, and produced a binary result. In effect, they were using the constructed MM as a {N,D}FA.
Someday more will be here.
Ideally, we would be using the algorithm from stolcke94bestfirst. Constructing a DFA rather than a NFA in effect has performed most of the state merging that stolcke93hidden do.
Consider also a java or C/C++ implementaion: http://www.ghmm.org/ http://www.run.montefiore.ulg.ac.be/~francois/software/jahmm/
Useful information: http://www.cs.brown.edu/research/ai/dynamics/tutorial/Documents/HiddenMarkovModels.html http://www.comp.leeds.ac.uk/roger/HiddenMarkovModels/html_dev/main.html L R Rabiner and B H Juang, `An introduction to HMMs, IEEE ASSP Magazine, 3, 4-16.
printvcg
printvcg(filehandle)
Print in a form usable by VCG for printing the DFA.
If the filehandle is specified, print there; otherwise, print to STDOUT.
This code was stolen from DFA, and does not know about the probabilities.
load(filehandle)
Load a MM from a file; this is the inverse of "print", and the format we expect is that used in $self->print.
test(tokensref, string, instance)
Test the string of tokens and calculate the probability of the string being seen. At each stage, we get a p in [0,1]. The result is the product of these probabilities.
Note that if a transition cannot be made, we return a 0 probability.
add(tokensref, string, instance)
The collection of tokens (in the list referenced by tokensref) is a complete example of a list that should be accepted by the DFA.
string and instance are IDS::Test framework arguments that we ignore because we do not need them.
WE add the transition from the last token to the (ACCEPT) state.
add_transition(from, token)
Add a transition from one state to another when the specified token is received. It is not an error to try to add an existing transition. In that event, this function quietly returns. If no such transition exists, we look for a transition on the token; if so, we add an edge to the destination node for the existing edge. Finally, if there is no other choice, we create a new state and add the edge.
generalize()
Reduce the number of states in the model.
Our building a DFA rather than a NFA has in effect performed most of the state merging that would have occurred.
XXX We should still be doing some checks for additional merge possibilities.
XXX A proof that the DFA is effectively the NFA with merged states would be useful.
Download (0.032MB)
Added: 2007-06-18 License: Perl Artistic License Price:
858 downloads
Algorithm::LUHN 1.00
Algorithm::LUHN is a Perl module to calculate the modulus 10 double add double checksum. more>>
Algorithm::LUHN is a Perl module to calculate the modulus 10 double add double checksum.
SYNOPSIS
use Algorithm::LUHN qw/check_digit is_valid/;
$c = check_digit("43881234567");
print "It worksn" if is_valid("43881234567$c");
$c = check_digit("A2C4E6G8"); # this will cause an error
print "Valid LUHN characters are:n";
my %vc = Algorithm::LUHN::valid_chars();
for (sort keys %vc) {
print "$_ => $vc{$_}n";
}
Algorithm::LUHN::valid_chars(map {$_ => ord($_)-ord(A)+10} A..Z);
$c = check_digit("A2C4E6G8");
print "It worked againn" if is_valid("A2C4E6G8$c");
This module calculates the Modulus 10 Double Add Double checksum, also known as the LUHN Formula. This algorithm is used to verify credit card numbers and Standard & Poors security identifiers such as CUSIPs and CSINs.
You can find plenty of information about the algorithm by searching the web for "modulus 10 double add double".
<<lessSYNOPSIS
use Algorithm::LUHN qw/check_digit is_valid/;
$c = check_digit("43881234567");
print "It worksn" if is_valid("43881234567$c");
$c = check_digit("A2C4E6G8"); # this will cause an error
print "Valid LUHN characters are:n";
my %vc = Algorithm::LUHN::valid_chars();
for (sort keys %vc) {
print "$_ => $vc{$_}n";
}
Algorithm::LUHN::valid_chars(map {$_ => ord($_)-ord(A)+10} A..Z);
$c = check_digit("A2C4E6G8");
print "It worked againn" if is_valid("A2C4E6G8$c");
This module calculates the Modulus 10 Double Add Double checksum, also known as the LUHN Formula. This algorithm is used to verify credit card numbers and Standard & Poors security identifiers such as CUSIPs and CSINs.
You can find plenty of information about the algorithm by searching the web for "modulus 10 double add double".
Download (0.004MB)
Added: 2007-05-16 License: Perl Artistic License Price:
893 downloads
Algorithm::Merge 0.08
Algorithm::Merge is a Perl module package that provides three-way merge and diff. more>>
Algorithm::Merge is a Perl module package that provides three-way merge and diff.
SYNOPSIS
use Algorithm::Merge qw(merge diff3 traverse_sequences3);
@merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
});
@merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
}, $key_generation_function);
$merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
});
$merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
}, $key_generation_function);
@diff = diff3(@ancestor, @a, @b);
@diff = diff3(@ancestor, @a, @b, $key_generation_function);
$diff = diff3(@ancestor, @a, @b);
$diff = diff3(@ancestor, @a, @b, $key_generation_function);
@trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
});
@trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
}, $key_generation_function);
$trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
});
$trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
}, $key_generation_function);
USAGE
This module complements Algorithm::Diff by providing three-way merge and diff functions.
In this documentation, the first list to diff3, merge, and traverse_sequences3 is called the `original list. The second list is the `left list. The third list is the `right list.
The optional key generation arguments are the same as in Algorithm::Diff. See Algorithm::Diff for more information.
<<lessSYNOPSIS
use Algorithm::Merge qw(merge diff3 traverse_sequences3);
@merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
});
@merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
}, $key_generation_function);
$merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
});
$merged = merge(@ancestor, @a, @b, {
CONFLICT => sub { }
}, $key_generation_function);
@diff = diff3(@ancestor, @a, @b);
@diff = diff3(@ancestor, @a, @b, $key_generation_function);
$diff = diff3(@ancestor, @a, @b);
$diff = diff3(@ancestor, @a, @b, $key_generation_function);
@trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
});
@trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
}, $key_generation_function);
$trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
});
$trav = traverse_sequences3(@ancestor, @a, @b, {
# callbacks
}, $key_generation_function);
USAGE
This module complements Algorithm::Diff by providing three-way merge and diff functions.
In this documentation, the first list to diff3, merge, and traverse_sequences3 is called the `original list. The second list is the `left list. The third list is the `right list.
The optional key generation arguments are the same as in Algorithm::Diff. See Algorithm::Diff for more information.
Download (0.010MB)
Added: 2007-05-16 License: Perl Artistic License Price:
892 downloads
Algorithm::Loops 1.031
Algorithm::Loops is a Perl module with looping constructs: NestedLoops, MapCar*, Filter, and NextPermute*. more>>
Algorithm::Loops is a Perl module with looping constructs: NestedLoops, MapCar*, Filter, and NextPermute*.
SYNOPSYS
use Algorithm::Loops qw(
Filter
MapCar MapCarU MapCarE MapCarMin
NextPermute NextPermuteNum
NestedLoops
);
my @copy= Filter {tr/A-Z.,"()/a-z/d} @list;
my $string= Filter {s/s*$/ /} @lines;
my @transposed= MapCarU {[@_]} @matrix;
my @list= sort getList();
do {
usePermutation( @list );
} while( NextPermute( @list ) );
my $len= @ARGV ? $ARGV[0] : 3;
my @list= NestedLoops(
[ ( [ 1..$len ] ) x $len ],
sub { "@_" },
);
If you want working sample code to try, see below in the section specific to the function(s) you want to try. The above samples only give a feel for how the functions are typically used.
<<lessSYNOPSYS
use Algorithm::Loops qw(
Filter
MapCar MapCarU MapCarE MapCarMin
NextPermute NextPermuteNum
NestedLoops
);
my @copy= Filter {tr/A-Z.,"()/a-z/d} @list;
my $string= Filter {s/s*$/ /} @lines;
my @transposed= MapCarU {[@_]} @matrix;
my @list= sort getList();
do {
usePermutation( @list );
} while( NextPermute( @list ) );
my $len= @ARGV ? $ARGV[0] : 3;
my @list= NestedLoops(
[ ( [ 1..$len ] ) x $len ],
sub { "@_" },
);
If you want working sample code to try, see below in the section specific to the function(s) you want to try. The above samples only give a feel for how the functions are typically used.
Download (0.022MB)
Added: 2006-10-12 License: Perl Artistic License Price:
1107 downloads
Algorithm::Diff 1.1902
Algorithm::Diff is a Perl module to compute `intelligent differences between two files / lists. more>>
Algorithm::Diff is a Perl module to compute `intelligent differences between two files / lists.
SYNOPSIS
require Algorithm::Diff;
# This example produces traditional diff output:
my $diff = Algorithm::Diff->new( @seq1, @seq2 );
$diff->Base( 1 ); # Return line numbers, not indices
while( $diff->Next() ) {
next if $diff->Same();
my $sep = ;
if( ! $diff->Items(2) ) {
printf "%d,%dd%dn",
$diff->Get(qw( Min1 Max1 Max2 ));
} elsif( ! $diff->Items(1) ) {
printf "%da%d,%dn",
$diff->Get(qw( Max1 Min2 Max2 ));
} else {
$sep = "---n";
printf "%d,%dc%d,%dn",
$diff->Get(qw( Min1 Max1 Min2 Max2 ));
}
print "< $_" for $diff->Items(1);
print $sep;
print "> $_" for $diff->Items(2);
}
# Alternate interfaces:
use Algorithm::Diff qw(
LCS LCS_length LCSidx
diff sdiff compact_diff
traverse_sequences traverse_balanced );
@lcs = LCS( @seq1, @seq2 );
$lcsref = LCS( @seq1, @seq2 );
$count = LCS_length( @seq1, @seq2 );
( $seq1idxref, $seq2idxref ) = LCSidx( @seq1, @seq2 );
# Complicated interfaces:
@diffs = diff( @seq1, @seq2 );
@sdiffs = sdiff( @seq1, @seq2 );
@cdiffs = compact_diff( @seq1, @seq2 );
traverse_sequences(
@seq1,
@seq2,
{ MATCH => &callback1,
DISCARD_A => &callback2,
DISCARD_B => &callback3,
},
&key_generator,
@extra_args,
);
traverse_balanced(
@seq1,
@seq2,
{ MATCH => &callback1,
DISCARD_A => &callback2,
DISCARD_B => &callback3,
CHANGE => &callback4,
},
&key_generator,
@extra_args,
);
<<lessSYNOPSIS
require Algorithm::Diff;
# This example produces traditional diff output:
my $diff = Algorithm::Diff->new( @seq1, @seq2 );
$diff->Base( 1 ); # Return line numbers, not indices
while( $diff->Next() ) {
next if $diff->Same();
my $sep = ;
if( ! $diff->Items(2) ) {
printf "%d,%dd%dn",
$diff->Get(qw( Min1 Max1 Max2 ));
} elsif( ! $diff->Items(1) ) {
printf "%da%d,%dn",
$diff->Get(qw( Max1 Min2 Max2 ));
} else {
$sep = "---n";
printf "%d,%dc%d,%dn",
$diff->Get(qw( Min1 Max1 Min2 Max2 ));
}
print "< $_" for $diff->Items(1);
print $sep;
print "> $_" for $diff->Items(2);
}
# Alternate interfaces:
use Algorithm::Diff qw(
LCS LCS_length LCSidx
diff sdiff compact_diff
traverse_sequences traverse_balanced );
@lcs = LCS( @seq1, @seq2 );
$lcsref = LCS( @seq1, @seq2 );
$count = LCS_length( @seq1, @seq2 );
( $seq1idxref, $seq2idxref ) = LCSidx( @seq1, @seq2 );
# Complicated interfaces:
@diffs = diff( @seq1, @seq2 );
@sdiffs = sdiff( @seq1, @seq2 );
@cdiffs = compact_diff( @seq1, @seq2 );
traverse_sequences(
@seq1,
@seq2,
{ MATCH => &callback1,
DISCARD_A => &callback2,
DISCARD_B => &callback3,
},
&key_generator,
@extra_args,
);
traverse_balanced(
@seq1,
@seq2,
{ MATCH => &callback1,
DISCARD_A => &callback2,
DISCARD_B => &callback3,
CHANGE => &callback4,
},
&key_generator,
@extra_args,
);
Download (0.033MB)
Added: 2007-06-28 License: Perl Artistic License Price:
848 downloads
Algorithm::BinPack 0.5
Algorithm::BinPack is a Perl module that can efficiently pack items into bins. more>>
Algorithm::BinPack is a Perl module that can efficiently pack items into bins.
SYNOPSIS
Algorithm::BinPack efficiently packs items into bins. The bins are given a maximum size, and items are packed in with as little empty space as possible. An example use would be backing up files to CD, while minimizing the number of discs required.
my $bp = Algorithm::BinPack->new(binsize => 4);
$bp->add_item(label => "one", size => 1);
$bp->add_item(label => "two", size => 2);
$bp->add_item(label => "three", size => 3);
$bp->add_item(label => "four", size => 4);
for ($bp->pack_bins) {
print "Bin size: ", $_->{size}, "n";
print " Item: ", $_->{label}, "n" for @{ $_->{items} };
}
METHODS
new
Creates a new Algorithm::BinPack object. The maximum bin size is specified as a named argument binsize, and is required. A fudge factor may be specified as a named argument fudge. If a fudge factor is specified, item sizes will be rounded up to a number divisible by the fudge factor. This can help keep items with similar sizes in order by their labels.
my $bp = Algorithm::BinPack->new(binsize => 4);
my $bp = Algorithm::BinPack->new(binsize => 100, fudge => 10);
add_item
Adds an item to be packed into a bin. Required named arguments are label and size, but any others can be specified, and will be saved. An optional bin argument can be used to manually put an item into the specified bin.
$bp->add_item(label => one, size => 1);
$bp->add_item(label => two, size => 2, desc => The second numeral);
$bp->add_item(label => zero, size => 3, bin => 0);
$bp->add_item(qw(label three size 3));
$bp->add_item(qw(label four size 4 random key));
prefill_bin
(Deprecated method) add_item now knows how to handle the bin argument directly, so this method is redundant.
pack_bins
Packs the items into bins. This method tries to leave as little empty space in each bin as possible. It returns a list of hashrefs with the key size containing the total bin size, and items containing an arrayref holding the items in the bin. Each item is in turn a hashref containing the keys label, size, and any others added to the item. If a fudge factor was used, each item will contain a key fudgesize, which is the size this item was fudged to.
for my $bin ($bp->pack_bins) {
print "Bin size: ", $bin->{size}, "n";
for my $item (@{ $bin->{items} }) {
printf " %-6s %-20sn", $_, $item->{$_} for keys %{ $item };
print " ---n";
}
}
<<lessSYNOPSIS
Algorithm::BinPack efficiently packs items into bins. The bins are given a maximum size, and items are packed in with as little empty space as possible. An example use would be backing up files to CD, while minimizing the number of discs required.
my $bp = Algorithm::BinPack->new(binsize => 4);
$bp->add_item(label => "one", size => 1);
$bp->add_item(label => "two", size => 2);
$bp->add_item(label => "three", size => 3);
$bp->add_item(label => "four", size => 4);
for ($bp->pack_bins) {
print "Bin size: ", $_->{size}, "n";
print " Item: ", $_->{label}, "n" for @{ $_->{items} };
}
METHODS
new
Creates a new Algorithm::BinPack object. The maximum bin size is specified as a named argument binsize, and is required. A fudge factor may be specified as a named argument fudge. If a fudge factor is specified, item sizes will be rounded up to a number divisible by the fudge factor. This can help keep items with similar sizes in order by their labels.
my $bp = Algorithm::BinPack->new(binsize => 4);
my $bp = Algorithm::BinPack->new(binsize => 100, fudge => 10);
add_item
Adds an item to be packed into a bin. Required named arguments are label and size, but any others can be specified, and will be saved. An optional bin argument can be used to manually put an item into the specified bin.
$bp->add_item(label => one, size => 1);
$bp->add_item(label => two, size => 2, desc => The second numeral);
$bp->add_item(label => zero, size => 3, bin => 0);
$bp->add_item(qw(label three size 3));
$bp->add_item(qw(label four size 4 random key));
prefill_bin
(Deprecated method) add_item now knows how to handle the bin argument directly, so this method is redundant.
pack_bins
Packs the items into bins. This method tries to leave as little empty space in each bin as possible. It returns a list of hashrefs with the key size containing the total bin size, and items containing an arrayref holding the items in the bin. Each item is in turn a hashref containing the keys label, size, and any others added to the item. If a fudge factor was used, each item will contain a key fudgesize, which is the size this item was fudged to.
for my $bin ($bp->pack_bins) {
print "Bin size: ", $bin->{size}, "n";
for my $item (@{ $bin->{items} }) {
printf " %-6s %-20sn", $_, $item->{$_} for keys %{ $item };
print " ---n";
}
}
Download (0.004MB)
Added: 2007-05-16 License: Perl Artistic License Price:
891 downloads
Algorithm::SISort 0.14
Algorithm::SISort is a Perl module that contains select and insert sorting algorithm. more>> <<less
Download (0.004MB)
Added: 2007-05-17 License: Perl Artistic License Price:
890 downloads
Algorithm::DiffOld 1.15
Algorithm::DiffOld is a Perl module to compute `intelligent differences between two files / lists but use the old interface. more>>
Algorithm::DiffOld is a Perl module to compute `intelligent differences between two files / lists but use the old ( $callback,
DISCARD_A => $callback,
DISCARD_B => $callback,
},
$comparison_function );
COMPARISON FUNCTIONS
Each of the main routines should be passed a comparison function. If you arent passing one in, use Algorithm::Diff instead.
These functions should return a true value when two items should compare as equal.
For instance,
@lcs = LCS( @seq1, @seq2, sub { my ($a, $b) = @_; $a eq $b } );
but if that is all youre doing with your comparison function, just use Algorithm::Diff and let it do this (this is its default).
Or:
sub someFunkyComparisonFunction
{
my ($a, $b) = @_;
$a =~ m{$b};
}
@diffs = diff( @lines, @patterns, &someFunkyComparisonFunction );
which would allow you to diff an array @lines which consists of text lines with an array @patterns which consists of regular expressions.
This is actually the reason I wrote this version -- there is no way to do this with a key generation function as in the stock Algorithm::Diff.
<<lessDISCARD_A => $callback,
DISCARD_B => $callback,
},
$comparison_function );
COMPARISON FUNCTIONS
Each of the main routines should be passed a comparison function. If you arent passing one in, use Algorithm::Diff instead.
These functions should return a true value when two items should compare as equal.
For instance,
@lcs = LCS( @seq1, @seq2, sub { my ($a, $b) = @_; $a eq $b } );
but if that is all youre doing with your comparison function, just use Algorithm::Diff and let it do this (this is its default).
Or:
sub someFunkyComparisonFunction
{
my ($a, $b) = @_;
$a =~ m{$b};
}
@diffs = diff( @lines, @patterns, &someFunkyComparisonFunction );
which would allow you to diff an array @lines which consists of text lines with an array @patterns which consists of regular expressions.
This is actually the reason I wrote this version -- there is no way to do this with a key generation function as in the stock Algorithm::Diff.
Download (0.023MB)
Added: 2007-08-01 License: Perl Artistic License Price:
814 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above backtracking algorithm search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed