Opened 4 years ago

Closed 2 years ago

Last modified 2 years ago

#2069 closed enhancement (done)

Implement GP problem for code generation

Reported by: ascheibe Owned by: gkronber
Priority: medium Milestone: HeuristicLab 3.3.13
Component: Problems.GeneticProgramming Version: 3.3.12
Keywords: Cc:

Description (last modified by ascheibe)

This works at the moment for RoboCode but should be generalized in the future for other games/applications.

There are two branches for this ticket:

Attachments (1)

robocode.png (211.3 KB) - added by gkronber 2 years ago.
Screenshot of a solution running

Download all attachments as: .zip

Change History (90)

comment:1 Changed 4 years ago by ascheibe

  • Status changed from new to accepted

comment:2 Changed 4 years ago by ascheibe

r9414 added robocode branch

comment:3 Changed 4 years ago by ascheibe

r9565 Robocode Plugin code without Mutation Operators

comment:4 Changed 4 years ago by ascheibe

r9567, r9570 some bugfixes

comment:5 Changed 4 years ago by ascheibe

r9601

  • fixed cloning in Solution so that the SolutionCodeView can run a battle
  • fixed a compiler warning in CodeNodeView

comment:6 Changed 4 years ago by ascheibe

  • Description modified (diff)

comment:7 Changed 4 years ago by ascheibe

r9603 fixed object disposed exception in CodeNodeView that occurred when switching the viewhost

comment:8 Changed 4 years ago by ascheibe

r9609

  • Added EmptyEvent.cs
  • Modified Grammar.cs to allow EmptyEvent as a child in place of all Event Methods except for Run and OnScannedEvent

comment:9 Changed 4 years ago by ascheibe

r9612

  • fixed error handling for external program calls
  • added missing StorableClass attribute

comment:10 Changed 4 years ago by ascheibe

r9630 fixed cloning constructors and formatting

comment:11 Changed 4 years ago by ascheibe

r9631 tanks should only be required to implement run, the other methods should be optional

comment:12 Changed 4 years ago by ascheibe

r9642 Changed back the Grammar to require OnScannedRobot event

comment:13 Changed 4 years ago by ascheibe

r9760 created own branch for robocode trunk integration

comment:14 Changed 4 years ago by ascheibe

  • Description modified (diff)

comment:15 Changed 4 years ago by ascheibe

r9761 fixed project file to work with our directory layout

comment:16 Changed 4 years ago by ascheibe

r9763 added frame files

comment:17 Changed 4 years ago by ascheibe

r9779 created an own plugin for the views

comment:18 Changed 4 years ago by ascheibe

r9780 fixed naming of project files

comment:19 Changed 4 years ago by ascheibe

r9781 fixed folder layout

comment:20 Changed 4 years ago by ascheibe

r9787 sign assemblies and cleaned up plugin dependencies

comment:21 Changed 4 years ago by ascheibe

r9790

  • added license headers
  • corrected version information
  • fixed formatting

comment:22 Changed 4 years ago by ascheibe

r9879 removed unused symbols and cleaned up code

comment:23 Changed 4 years ago by ascheibe

r9880 removed dead code

comment:24 Changed 4 years ago by ascheibe

r9881 improved interpreter

comment:25 Changed 4 years ago by ascheibe

r9882 cleaned up battlerunner

comment:26 Changed 4 years ago by ascheibe

r9884

  • qualities are now scaled between 0 and 1
  • fixed naming of robots

comment:27 Changed 4 years ago by ascheibe

r9888

  • fixed parsing of qualities
  • removed robocode method crossover as it was never used anyways

comment:28 Changed 4 years ago by ascheibe

r9889 cleaned up views

comment:29 Changed 4 years ago by ascheibe

r9890

  • changed Solution from NamedItem to Item
  • adapted views to be only ItemViews
  • some more minor improvements

comment:30 Changed 4 years ago by ascheibe

r9891 moved battle runner from Robocode directory to HL bin

comment:31 Changed 4 years ago by ascheibe

r9892 use directory values instead of string values for the robocode path

comment:32 Changed 4 years ago by ascheibe

r9898 added automatic discovery of robocode jars

comment:33 Changed 4 years ago by ascheibe

r9899 fixed bug in quality calculation

comment:34 Changed 4 years ago by ascheibe

r9926

  • renamed path parameter to robocode path
  • made number of rounds configurable

comment:35 Changed 4 years ago by jkarder

r9947:

  • modified the RobocodeProblem to extract all robots in robocode directory
  • modified the battle runner to take a number of enemies that should be battled

comment:36 Changed 4 years ago by ascheibe

r9962 some minor fixes in the enemy detection

comment:37 Changed 4 years ago by ascheibe

r9966 improved robot detection in BattleRunner

comment:38 Changed 4 years ago by ascheibe

r9967 removed External Evaluator folder

comment:39 Changed 4 years ago by ascheibe

r9971 added a view for displaying/reloading enemies

comment:40 Changed 4 years ago by ascheibe

r9972 improved EnemyCollectionView

comment:41 Changed 4 years ago by ascheibe

r9983 fixed project file

comment:42 Changed 4 years ago by jkarder

r9985:

  • fixed deserialization of the RobocodeProblem
  • added a BattleRunnerDialog that allows to configure some arguments of the battle runner
  • added functionality to save a Solution in a java file

comment:43 Changed 4 years ago by jkarder

r10011:

  • refactored grammar and symbols
  • fixed cloning and storable ctors
  • fixed plugin dependencies

comment:44 Changed 4 years ago by jkarder

r10014:

  • refactored grammar and symbols
  • changed RobocodeProblem to use the ProbabilisticTreeCreator by default

comment:45 follow-up: Changed 4 years ago by ascheibe

@jkarder: Thanks a lot for improving the grammar, looks very good! Are you finished with the grammar or are there still any open issues?

comment:46 Changed 4 years ago by jkarder

r10028:

  • merged IfStat and ElseStat into IfThenElseStat
  • changed the font of the suffixCode text box in the CodeNodeView

comment:47 in reply to: ↑ 45 Changed 4 years ago by jkarder

Replying to ascheibe:

@jkarder: Thanks a lot for improving the grammar, looks very good! Are you finished with the grammar or are there still any open issues?

Thanks! I think there still might be some refactoring left to do, but I will leave the code as is for now.

comment:48 Changed 4 years ago by ascheibe

r10043

  • use groups for defining allowed child symbols in grammar
  • split functions group into functions and actions in grammar
  • moved run symbol to event group in grammar
  • fixed a bug in the ifthenelse symbol
  • enemy collection now marks one enemy per default

comment:49 Changed 4 years ago by ascheibe

r10044

  • incremented version number
  • fixed a bug in ShotPower
  • updated BattleRunner docu

comment:50 Changed 4 years ago by ascheibe

r10045 fixed a bug in the BattleRunner

comment:51 Changed 4 years ago by ascheibe

r10046 simplified Interpret methods of symbols

comment:52 Changed 4 years ago by ascheibe

r10047 don't use architecture operators as the Robocode problem does not support ADFs

comment:53 Changed 4 years ago by ascheibe

  • Owner changed from ascheibe to mkommend
  • Status changed from accepted to reviewing

r10048 center BattleRunner dialog

comment:54 Changed 4 years ago by ascheibe

  • Milestone changed from HeuristicLab 3.3.x Backlog to HeuristicLab 3.3.10

comment:55 Changed 4 years ago by mkommend

  • Milestone changed from HeuristicLab 3.3.10 to HeuristicLab 3.3.x Backlog

comment:56 Changed 4 years ago by ascheibe

  • Milestone changed from HeuristicLab 3.3.x Backlog to HeuristicLab 3.3.10
  • Owner changed from mkommend to gkronber

comment:57 Changed 3 years ago by gkronber

  • Owner changed from gkronber to ascheibe

I won't be able to finish a thorough review of this for the upcoming release. Therefore, I suggest that we move this ticket to the next milestone.

Please reassign the ticket back to me if moving it to the next milestone is ok for you.

comment:58 Changed 3 years ago by ascheibe

  • Owner changed from ascheibe to gkronber

Thanks for the note, sure, no problem.

comment:59 Changed 3 years ago by ascheibe

  • Milestone changed from HeuristicLab 3.3.10 to HeuristicLab 3.3.11

I'm moving this to 3.3.11 as it won't be ready for the next release.

comment:60 Changed 3 years ago by ascheibe

r11628 switched robocode trunk integration branch to .NET 4.5

comment:61 Changed 3 years ago by ascheibe

  • Milestone changed from HeuristicLab 3.3.11 to HeuristicLab 3.3.12

comment:62 Changed 2 years ago by gkronber

  • Milestone changed from HeuristicLab 3.3.12 to HeuristicLab 3.3.13

Sorry

comment:63 Changed 2 years ago by gkronber

r13009: fixed compilation error with current trunk version & recompiled java class files to work with robocode version (1.9.2.4). Class files must be recompiled for new robocode versions.

This version runs on my computer with the current trunk. Looks pretty cool!

Necessary:

  • robocode-1.9.2.4 must be installed in c:\robocode
  • I had to create a folder called "Evaluation" in c:\robocode\robots
Last edited 2 years ago by gkronber (previous) (diff)

comment:64 Changed 2 years ago by gkronber

r13010: fixed license headers

comment:65 Changed 2 years ago by gkronber

r13011: changed namespaces for trunk integration

comment:66 Changed 2 years ago by gkronber

r13013: reviewing and minor changes

comment:67 Changed 2 years ago by gkronber

r13015: refactored Robocode problem and derived from SymbolicExpressionTreeProblem

comment:68 Changed 2 years ago by gkronber

r13017: refactored grammar, symbols, and interpreter

comment:69 Changed 2 years ago by gkronber

r13018: cleaned code and renamed files

comment:70 Changed 2 years ago by gkronber

r13019: added necessary robocode files to project to make sure that the robocode problem is self-contained (only a java installation is necessary)

comment:71 Changed 2 years ago by gkronber

  • Owner changed from gkronber to architects

comment:72 Changed 2 years ago by gkronber

  • Owner changed from architects to gkronber
  • Status changed from reviewing to assigned

comment:73 Changed 2 years ago by gkronber

TODO:

  • copy files to trunk
  • create a sample
Last edited 2 years ago by gkronber (previous) (diff)

comment:74 Changed 2 years ago by gkronber

r13210: copied relevant files for robocode problem from branch to trunk. I didn't preserve the history in this step.

Last edited 2 years ago by gkronber (previous) (diff)

comment:75 Changed 2 years ago by gkronber

Notes:

  • If we want to deploy the robocode files directly (not archived) then we would need to specify each file as a plugin file in the plugin class.
  • It is seemingly not possible to copy a file located in a folder in the project directly to the bin folder (without preserving the folder structure)
  • An installation of java is necessary for the plugin

comment:76 Changed 2 years ago by gkronber

r13225: added plugin dependency

comment:77 Changed 2 years ago by gkronber

  • Version changed from branch to 3.3.12

comment:78 Changed 2 years ago by gkronber

r13264: terminated Robocode feature development branch r13265: terminated robocode trunk integration branch

comment:79 follow-up: Changed 2 years ago by gkronber

Robocode does not work with parallel engine. Robocode framework accesses writes to a common file which leads to exceptions when multiple java-processes try to write that file.

comment:80 Changed 2 years ago by gkronber

r13266: added a unit test to create a robocode sample.

comment:81 in reply to: ↑ 79 ; follow-up: Changed 2 years ago by mkommend

Replying to gkronber:

Robocode does not work with parallel engine. Robocode framework accesses writes to a common file which leads to exceptions when multiple java-processes try to write that file.

OK, what about synchronizing the whole evaluate method?

Changed 2 years ago by gkronber

Screenshot of a solution running

comment:82 in reply to: ↑ 81 Changed 2 years ago by gkronber

Replying to mkommend:

Replying to gkronber:

Robocode does not work with parallel engine. Robocode framework accesses writes to a common file which leads to exceptions when multiple java-processes try to write that file.

OK, what about synchronizing the whole evaluate method?

Yes... This will be a similar case as we had for the MATLAB COM object. Synchronization must work over multiple instances of the robocode evaluator.

Last edited 2 years ago by gkronber (previous) (diff)

comment:83 Changed 2 years ago by gkronber

  • Owner changed from gkronber to mkommend
  • Status changed from assigned to reviewing

r13309: added synchronization for the evaluation of robocode programs

comment:84 Changed 2 years ago by mkommend

r13311: Minor code changes in interpreter, restricted ShotPowerTreeNode to [0.1,3], changed evaluation of InterpretComparison.

Please have a look of the change in ShotPowerTreeNode and the InterpretComparison method.

comment:85 Changed 2 years ago by mkommend

Reviewed the HL.Problems.GP.Robocode plugin instead of the individual changesets. Some minor issues were corrected with r13311. Beside that I found no other issues.

A test of the robocode optimization is still pending, as I have no JDK installed and must test this on my workstation.

comment:86 Changed 2 years ago by gkronber

r13312: merged r13210,r13225,r13266,r13309,r13311 from trunk to stable

comment:87 Changed 2 years ago by gkronber

  • Owner changed from mkommend to gkronber
  • Status changed from reviewing to readytorelease

comment:88 Changed 2 years ago by gkronber

  • Resolution set to done
  • Status changed from readytorelease to closed

comment:89 Changed 2 years ago by abeham

  • Component changed from General to Problems.GeneticProgramming
Note: See TracTickets for help on using tickets.