Loading ...
Sorry, an error occurred while loading the content.
 

problem with ecj

Expand Messages
  • Mike Eggleston
    I found over the weekend I am exhausting available memory in ecj. I have 256MB on the current machine with 512MB swap. Memory is exhausted typically after 150
    Message 1 of 3 , Dec 2, 2002
      I found over the weekend I am exhausting available memory in ecj.
      I have 256MB on the current machine with 512MB swap. Memory is
      exhausted typically after 150 generations and ecj aborts. I find
      that when I include my IF functions the problem happens, but the
      problem does not happen when I do not include these functions.

      I'm attaching my parameter file and the two files for the IF routines.

      Does anyone see anything wrong?

      Mike

      ------------ parms --------------

      parent.0 = ../../gp/koza/koza.params

      # the next four items are already defined in koza.params, but we
      # put them here to be clear.

      # multithreading
      #breedthreads = 5
      #evalthreads = 5
      seed.0 = 1234
      seed.1 = 2345
      seed.2 = 3456
      seed.3 = 4567
      seed.4 = 5678
      #seed.5 = 6789
      #seed.6 = 7890
      #seed.7 = 8901
      #seed.8 = 9012
      #seed.9 = 1256

      pop.subpop.0.species.ind.numtrees = 2

      # "The result-producing branch" (Koza-II p. 84)
      pop.subpop.0.species.ind.tree.0 = ec.gp.GPTree
      pop.subpop.0.species.ind.tree.0.tc = tc0
      # "ADF0 body" (Koza-II p. 84)
      pop.subpop.0.species.ind.tree.1 = ec.gp.GPTree
      pop.subpop.0.species.ind.tree.1.tc = tc1

      # Now, let's define what tc0, and tc1 are.
      # Each has a different function set, f0 and f1

      gp.tc.size = 2

      gp.tc.0 = ec.gp.GPTreeConstraints
      gp.tc.0.name = tc0
      gp.tc.0.fset = f0
      gp.tc.0.returns = nil
      gp.tc.0.init = ec.gp.koza.HalfBuilder
      gp.tc.0.init.growp = 0.5
      gp.tc.0.init.min = 2
      gp.tc.0.init.max = 6

      gp.tc.1 = ec.gp.GPTreeConstraints
      gp.tc.1.name = tc1
      gp.tc.1.fset = f1
      gp.tc.1.returns = nil
      gp.tc.1.init = ec.gp.koza.HalfBuilder
      gp.tc.1.init.growp = 0.5
      gp.tc.1.init.min = 2
      gp.tc.1.init.max = 6

      # We have one function set, of class GPFunctionSet
      gp.fs.size = 2
      gp.fs.0 = ec.gp.GPFunctionSet
      gp.fs.1 = ec.gp.GPFunctionSet

      # We'll call the function set "f0". It uses the default GPFuncInfo class
      gp.fs.0.name = f0
      gp.fs.0.info = ec.gp.GPFuncInfo
      gp.fs.1.name = f1
      gp.fs.1.info = ec.gp.GPFuncInfo

      # size of the function set
      gp.fs.0.size = 22

      # function set contents
      gp.fs.0.func.0 = ec.app.cc1.func.Add
      gp.fs.0.func.0.nc = nc2
      gp.fs.0.func.1 = ec.app.cc1.func.Sub
      gp.fs.0.func.1.nc = nc2
      gp.fs.0.func.2 = ec.app.cc1.func.Mul
      gp.fs.0.func.2.nc = nc2
      gp.fs.0.func.3 = ec.app.cc1.func.Div
      gp.fs.0.func.3.nc = nc2
      gp.fs.0.func.4 = ec.app.cc1.func.Mod
      gp.fs.0.func.4.nc = nc2

      gp.fs.0.func.5 = ec.app.cc1.func.C1
      gp.fs.0.func.5.nc = nc0
      gp.fs.0.func.6 = ec.app.cc1.func.C2
      gp.fs.0.func.6.nc = nc0
      gp.fs.0.func.7 = ec.app.cc1.func.C3
      gp.fs.0.func.7.nc = nc0
      gp.fs.0.func.8 = ec.app.cc1.func.C4
      gp.fs.0.func.8.nc = nc0
      gp.fs.0.func.9 = ec.app.cc1.func.C5
      gp.fs.0.func.9.nc = nc0
      gp.fs.0.func.10 = ec.app.cc1.func.C6
      gp.fs.0.func.10.nc = nc0
      gp.fs.0.func.11 = ec.app.cc1.func.C7
      gp.fs.0.func.11.nc = nc0
      gp.fs.0.func.12 = ec.app.cc1.func.C8
      gp.fs.0.func.12.nc = nc0
      gp.fs.0.func.13 = ec.app.cc1.func.C9
      gp.fs.0.func.13.nc = nc0

      gp.fs.0.func.14 = ec.app.cc1.func.Sin
      gp.fs.0.func.14.nc = nc1
      gp.fs.0.func.15 = ec.app.cc1.func.Cos
      gp.fs.0.func.15.nc = nc1
      gp.fs.0.func.16 = ec.app.cc1.func.ASin
      gp.fs.0.func.16.nc = nc1
      gp.fs.0.func.17 = ec.app.cc1.func.ACos
      gp.fs.0.func.17.nc = nc1

      gp.fs.0.func.18 = ec.app.cc1.func.EQ
      gp.fs.0.func.18.nc = nc4
      gp.fs.0.func.19 = ec.app.cc1.func.LT
      gp.fs.0.func.19.nc = nc4
      gp.fs.0.func.20 = ec.app.cc1.func.GT
      gp.fs.0.func.20.nc = nc4

      gp.fs.0.func.21 = ec.gp.ADF
      gp.fs.0.func.21.tree = 1
      gp.fs.0.func.21.name = 0
      gp.fs.0.func.21.nc = nc3

      # size of the function set
      gp.fs.1.size = 24

      # function set contents
      gp.fs.1.func.0 = ec.app.cc1.func.Add
      gp.fs.1.func.0.nc = nc2
      gp.fs.1.func.1 = ec.app.cc1.func.Sub
      gp.fs.1.func.1.nc = nc2
      gp.fs.1.func.2 = ec.app.cc1.func.Mul
      gp.fs.1.func.2.nc = nc2
      gp.fs.1.func.3 = ec.app.cc1.func.Div
      gp.fs.1.func.3.nc = nc2
      gp.fs.1.func.4 = ec.app.cc1.func.Mod
      gp.fs.1.func.4.nc = nc2

      gp.fs.1.func.5 = ec.app.cc1.func.C1
      gp.fs.1.func.5.nc = nc0
      gp.fs.1.func.6 = ec.app.cc1.func.C2
      gp.fs.1.func.6.nc = nc0
      gp.fs.1.func.7 = ec.app.cc1.func.C3
      gp.fs.1.func.7.nc = nc0
      gp.fs.1.func.8 = ec.app.cc1.func.C4
      gp.fs.1.func.8.nc = nc0
      gp.fs.1.func.9 = ec.app.cc1.func.C5
      gp.fs.1.func.9.nc = nc0
      gp.fs.1.func.10 = ec.app.cc1.func.C6
      gp.fs.1.func.10.nc = nc0
      gp.fs.1.func.11 = ec.app.cc1.func.C7
      gp.fs.1.func.11.nc = nc0
      gp.fs.1.func.12 = ec.app.cc1.func.C8
      gp.fs.1.func.12.nc = nc0
      gp.fs.1.func.13 = ec.app.cc1.func.C9
      gp.fs.1.func.13.nc = nc0

      gp.fs.1.func.14 = ec.app.cc1.func.Sin
      gp.fs.1.func.14.nc = nc1
      gp.fs.1.func.15 = ec.app.cc1.func.Cos
      gp.fs.1.func.15.nc = nc1
      gp.fs.1.func.16 = ec.app.cc1.func.ASin
      gp.fs.1.func.16.nc = nc1
      gp.fs.1.func.17 = ec.app.cc1.func.ACOS
      gp.fs.1.func.17.nc = nc1

      gp.fs.1.func.18 = ec.app.cc1.func.EQ
      gp.fs.1.func.18.nc = nc4
      gp.fs.1.func.19 = ec.app.cc1.func.LT
      gp.fs.1.func.19.nc = nc4
      gp.fs.1.func.20 = ec.app.cc1.func.GT
      gp.fs.1.func.20.nc = nc4

      gp.fs.1.func.21 = ec.gp.ADFArgument
      gp.fs.1.func.21.arg = 0
      gp.fs.1.func.21.nc = nc0
      gp.fs.1.func.22 = ec.gp.ADFArgument
      gp.fs.1.func.22.arg = 1
      gp.fs.1.func.22.nc = nc0
      gp.fs.1.func.23 = ec.gp.ADFArgument
      gp.fs.1.func.23.arg = 2
      gp.fs.1.func.23.nc = nc0

      eval.problem = ec.app.cc1.CC
      eval.problem.data = ec.app.cc1.func.DoubleData
      # The following should almost *always* be the same as eval.problem.data
      # For those who are interested, it defines the data object used internally
      # inside ADF stack contexts
      eval.problem.stack.context.data = ec.app.cc1.func.DoubleData

      # We have our own kind of statistics
      stat = ec.app.cc1.CCStatistics
      stat.file = r21.out
      stat.gather-full = true
      generations = 6000
      eval.problem.size = 100
      quit-on-run-complete = false
      #checkpoint = true
      #checkpoint-modulo = 5
      prefix = r21
      ------------ parms --------------
      ----------- IF.java ------------

      package ec.app.cc1.func;
      import ec.*;
      import ec.app.cc1.*;
      import ec.gp.*;
      import ec.util.*;

      /*
      * IF.java
      */

      abstract public class IF extends GPNode {
      public static int EQ = 0;
      public static int NE = 1;
      public static int LE = 2;
      public static int LT = 3;
      public static int GE = 4;
      public static int GT = 5;

      public String toString() {
      return "if";
      }

      public void checkConstraints(final EvolutionState state,
      final int tree,
      final GPIndividual typicalIndividual,
      final Parameter individualBase) {
      super.checkConstraints(state,tree,typicalIndividual,individualBase);
      if (children.length != 4)
      state.output.error("Incorrect number of children for node " +
      toStringForError() + " at " +
      individualBase);
      }

      public void eval(final int type,
      final EvolutionState state,
      final int thread,
      final GPData input,
      final ADFStack stack,
      final GPIndividual individual,
      final Problem problem) {
      boolean ans;
      double res;
      DoubleData rd = ((DoubleData)(input));

      children[0].eval(state, thread, input, stack, individual, problem);
      res = rd.x;
      children[1].eval(state, thread, input, stack, individual, problem);
      if(type == EQ && res == rd.x) {
      ans = true;
      } else if(type == NE && res != rd.x) {
      ans = true;
      } else if(type == LT && res < rd.x) {
      ans = true;
      } else if(type == LE && res <= rd.x) {
      ans = true;
      } else if(type == GT && res > rd.x) {
      ans = true;
      } else if(type == GE && res >= rd.x) {
      ans = true;
      } else {
      ans = false;
      }

      if(ans) {
      children[2].eval(state, thread, input, stack, individual, problem);
      } else { // return the third item.
      children[3].eval(state, thread, input, stack, individual, problem);
      }
      }
      }
      ----------- IF.java ------------
      ----------- EQ.java ------------

      package ec.app.cc1.func;
      import ec.*;
      import ec.app.cc1.*;
      import ec.gp.*;
      import ec.util.*;

      /*
      * EQ.java
      */

      public class EQ extends IF {
      public String toString() {
      return "IFEQ";
      }

      public void checkConstraints(final EvolutionState state,
      final int tree,
      final GPIndividual typicalIndividual,
      final Parameter individualBase) {
      super.checkConstraints(state,tree,typicalIndividual,individualBase);
      if (children.length!=4)
      state.output.error("Incorrect number of children for node " +
      toStringForError() + " at " +
      individualBase);
      }

      public void eval(final EvolutionState state,
      final int thread,
      final GPData input,
      final ADFStack stack,
      final GPIndividual individual,
      final Problem problem) {
      super.eval(EQ, state, thread, input, stack, individual, problem);
      }
      }
      ----------- EQ.java ------------
    • Mike Eggleston
      ... I changed the lines of super.eval(EQ...) in EQ.java and public void eval(...) in IF.java to IF(EQ...) and public void IF(...) respectively. Now things are
      Message 2 of 3 , Dec 2, 2002
        On Mon, 02 Dec 2002, Mike Eggleston wrote:

        > I found over the weekend I am exhausting available memory in ecj.
        > I have 256MB on the current machine with 512MB swap. Memory is
        > exhausted typically after 150 generations and ecj aborts. I find
        > that when I include my IF functions the problem happens, but the
        > problem does not happen when I do not include these functions.

        I changed the lines of super.eval(EQ...) in EQ.java and
        public void eval(...) in IF.java to IF(EQ...) and
        public void IF(...) respectively. Now things are back to running
        fast and not consuming core. Why does the change from super.eval()
        to IF() make that much of a difference?

        Mike
      • Sean Luke
        Mike, I will take this offline: perhaps it s best not bothering the whole GP community with code snippets. Sean ... k
        Message 3 of 3 , Dec 2, 2002
          Mike, I will take this offline: perhaps it's best not bothering the whole
          GP community with code snippets.

          Sean

          On Mon, 2 Dec 2002, Mike Eggleston wrote:

          > I found over the weekend I am exhausting available memory in ecj.
          > I have 256MB on the current machine with 512MB swap. Memory is
          > exhausted typically after 150 generations and ecj aborts. I find
          > that when I include my IF functions the problem happens, but the
          > problem does not happen when I do not include these functions.
          >
          > I'm attaching my parameter file and the two files for the IF routines.
          >
          > Does anyone see anything wrong?
          k
        Your message has been successfully submitted and would be delivered to recipients shortly.