OK, I have two pieces of pseudo code, which should be converted to a Java code, except not very good And I said, 'It is rarely good whenever its good .. Anyway I was hoping someone could help.
Here is the first bit of pseudo code:
- Make a random integer that is between 0 and n-1.
- Create empty New string is called x.
- Copy elements from 0 to P1 from Scassel to X.
- Copy the changed version of the string scassol to p to the X.
- Copy of N-1's Scansol from P + 1 to X.
- Set up Scassol to be x.
And here's the code, away (I originally did the first two steps but after that I got stuck):
Public Zero SmallChange () {Random rand = new random (); Rand.setSeed (System.currentTimeMillis ()); Int n = scasol.length (); Int p = Math.abs (rand.nextInt ()% n); String x; If (n
this is the second piece of code that I can not convert to Java (I have not done anything for it yet I completely stumped):
- We need to add for that loop which iterates for the number of iterations of the specified number.
- We need to make the initial random solution of size n.
- We need to evaluate the fitness of our current solution within the loop.
- We need to copy the current solution (old says).
- We make a small change to evaluate the current solution and fitness in any other variable.
- If the new fitness is worse than the old, then we copy the old solution back to our existing solution.
- Upon completion we can return the current solution.
The second problem is to complete a small change, while the other is to make a random intensity hill climbing algorithm, but yes the word is not stuck I hope someone can help you, I appreciate any help because I am trying to do this for days! The first bit of pseudocode says:
Enter It is not clear what is the statement of "changed version"?
Putting a character in the string is a simple task in Java.
SeeThe second piece of pseudocold is a dire requirement for reference and explanation.
/ div>
Comments
Post a Comment