Skip to content

Commit

Permalink
Added noop instruction. Began work on node selection tourneys.
Browse files Browse the repository at this point in the history
  • Loading branch information
thelmuth committed Nov 20, 2010
1 parent d0d516d commit c65c875
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 67 deletions.
65 changes: 65 additions & 0 deletions gpsamples/nodeselectiontesting.pushgp
@@ -0,0 +1,65 @@
# Copyright 2009-2010 Jon Klein
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# A sample PushGP file for a simple test symbolic regression problem.
# In this demo, the system solves the equation y = 12x^2 + 5.
#
# Tom Helmuth
# 11/20/2010
#

### Setup required parameters

problem-class = org.spiderland.Psh.ProbClass.FloatSymbolicRegression

max-generations = 500
population-size = 200
execution-limit = 150
max-points-in-program = 100
max-random-code-size = 40

tournament-size = 7
mutation-percent = 20
crossover-percent = 65
simplification-percent = 10

reproduction-simplifications = 25
report-simplifications = 100
final-simplifications = 10000

test-cases = ( ( 1 17 ) ( 2 53 ) ( 3 113 ) ( 4 197 ) ( 5 305 ) (6 437) (7 593))
instruction-set = ( float.* float.+ float.% float.- float.dup float.swap float.erc input.makeinputs1 )

### Setup Optional Parameters

trivial-geography-radius = 10
simplify-flatten-percent = 20

min-random-float = -20.0
max-random-float = 20.0
random-float-resolution = 0.5

target-function-string = y = 12x^2 + 5

### Setup optional parameters having to do with node selection and replacement

node-selection-mode = unbiased
koza-ratio-internal = 90
node-tournament-size = 2

#mutation-mode = fair
#fair-mutation-range = .5


9 changes: 9 additions & 0 deletions org/spiderland/Psh/Instructions.java
Expand Up @@ -1600,6 +1600,15 @@ public void Execute(Interpreter inI) {
}
}

class ExecNoop extends Instruction {
private static final long serialVersionUID = 1L;

@Override
public void Execute(Interpreter inI) {
// Does Nothing
}
}

class RandomPushCode extends ObjectStackInstruction {
private static final long serialVersionUID = 1L;

Expand Down
2 changes: 2 additions & 0 deletions org/spiderland/Psh/Interpreter.java
Expand Up @@ -136,10 +136,12 @@ public Interpreter() {
DefineInstruction("code.fromboolean", new CodeFromBoolean());
DefineInstruction("code.frominteger", new CodeFromInteger());
DefineInstruction("code.fromfloat", new CodeFromFloat());
DefineInstruction("code.noop", new ExecNoop());

DefineInstruction("exec.k", new ExecK(_execStack));
DefineInstruction("exec.s", new ExecS(_execStack, _maxPointsInProgram));
DefineInstruction("exec.y", new ExecY(_execStack));
DefineInstruction("exec.noop", new ExecNoop());

DefineInstruction("exec.do*times", new ExecDoTimes(this));
DefineInstruction("code.do*times", new CodeDoTimes(this));
Expand Down
2 changes: 1 addition & 1 deletion pushsamples/instructionTesting.push
@@ -1,2 +1,2 @@
(0 integer.ln)
(6 2.3 true exec.noop)
100
70 changes: 55 additions & 15 deletions tools/PushInstructionSet.txt
@@ -1,3 +1,23 @@
boolean.=
boolean.and
boolean.dup
boolean.flush
boolean.fromfloat
boolean.frominteger
boolean.not
boolean.or
boolean.pop
boolean.rand
boolean.rot
boolean.shove
boolean.stackdepth
boolean.swap
boolean.xor
boolean.yank
boolean.yankdup
true
false

integer.%
integer.*
integer.+
Expand All @@ -9,14 +29,22 @@ integer.>
integer.abs
integer.dup
integer.flush
integer.fromboolean
integer.fromfloat
integer.ln
integer.log
integer.max
integer.min
integer.neg
integer.pop
integer.pow
integer.rand
integer.rot
integer.shove
integer.stackdepth
integer.swap
integer.yank
integer.yankdup

float.%
float.*
Expand All @@ -31,30 +59,24 @@ float.cos
float.dup
float.exp
float.flush
float.fromboolean
float.frominteger
float.ln
float.log
float.max
float.min
float.neg
float.pop
float.pow
float.rand
float.rot
float.shove
float.sin
float.stackdepth
float.swap
float.tan

boolean.=
boolean.and
boolean.dup
boolean.flush
boolean.not
boolean.or
boolean.pop
boolean.rot
boolean.stackdepth
boolean.swap
boolean.xor
false
true
float.yank
float.yankdup

exec.=
exec.do*count
Expand All @@ -63,25 +85,40 @@ exec.do*times
exec.dup
exec.flush
exec.if
exec.k
exec.noop
exec.pop
exec.rand
exec.rot
exec.s
exec.shove
exec.stackdepth
exec.swap
exec.y
exec.yank
exec.yankdup

code.=
code.do*count
code.do*range
code.do*times
code.dup
code.flush
code.fromboolean
code.fromfloat
code.frominteger
code.if
code.noop
code.pop
code.quote
code.rand
code.rot
code.shove
code.stackdepth
code.swap
code.yank
code.yankdup

input.in0
input.inall
input.inallrev
input.index
Expand All @@ -91,8 +128,11 @@ name.dup
name.flush
name.pop
name.rot
name.shove
name.stackdepth
name.swap
name.yank
name.yankdup

frame.pop
frame.push
51 changes: 0 additions & 51 deletions tools/PushMissingInstructions.txt
@@ -1,53 +1,3 @@
Instructions to Add
===================
x boolean.fromfloat
x boolean.frominteger
x boolean.rand
x boolean.shove
x boolean.yank
x boolean.yankdup

x code.fromboolean
x code.fromfloat
x code.frominteger
x code.shove
x code.yank
x code.yankdup

x exec.shove
x exec.yank
x exec.yankdup
x exec.k
x exec.s
x exec.y

x code.rand
x exec.rand

x float.fromboolean
x float.frominteger
x float.rand
x float.shove
x float.yank
x float.yankdup

x integer.fromboolean
x integer.fromfloat
x integer.rand
x integer.shove
x integer.yank
x integer.yankdup

x name.shove
x name.yank
x name.yankdup

x integer.log
x integer.ln
x float.log
x float.ln


Instructions to Possibly Add.
==============================================
These code and exec instructions could be useful for generic fitness prediction
Expand Down Expand Up @@ -83,7 +33,6 @@ boolean.define
code.define
code.definition
code.instructions
code.noop

exec.define

Expand Down

0 comments on commit c65c875

Please sign in to comment.