UWS example: Algorithms

Description

This UWS - called Algorithms - proposes three different kinds of job: Chvatal, Syracuse and Ackerman. They correspond to (famous) algorithms which may take a long time in function of their parameters. Thus you will be able to play with the execution queue management and, in some cases, with the UWS errors (particularly the StackOverflowError with some parameters of Ackerman).

Besides, contrary to the UWS Timers, this UWS has been a little customized:

Additional UWS Action:

This UWS has an additional action which lets displaying a description and some statistics about this UWS.

Jobs lists

Chvatal

This algorithm must reorder an array of integer. Its values are function of its size: size=4 => {1,2,3,4}, size=7 => {1,2,3,4,5,6,7}, ... By default, these values are mixed. The algorithm must permute the array[i] first values until array[i] = i+1.
This algorithm is based on the algorithm of V. Chvatal:
while(array[1] != 1)
	// permute the first array[1] values
					

Add a new Job:

  • Array size:
  • Run now

Syracuse

Implementation of the algorithm of Syracuse also known as the problem of 3x+1. There, is the algorithm:
if (n==1)
	return 1;
else{
	if (n%2 == 0)
		return S(n/2);
	else
		return S(3n+1);
}
					

Add a new Job:

  • N =
  • Run now

Ackerman

It is a double recursive function whose the algorithm is:
if (m==0)
	return n+1;
else{
	if (n==0)
		return A(m-1, 1);
	else
		return A(m-1, A(m, n-1)); 
}
					

Add a new Job:

  • M =
  • N =
  • Run now

Sources

Resource Type Description
MyExtendedUWS Source A custom UWS which calls a specific constructor of AbstractJob.
UWSAlgorithms Source The servlet which manages the UWS Algorithms.
AboutAction Source A UWS action which gives some information and statistics about the UWS Algorithms.
JobChvatal Source A kind of Job which implements the algorithm of V. Chvatal.
JobSyracuse Source A kind of Job which implements the algorithm of Syracuse.
JobAckerman Source A kind of Job which implements the function Ackerman.
The used XSLT stylesheet XSLT Stylesheet The XSLT stylesheet used in the UWS Algorithms.