Opened 5 months ago

Last modified 5 months ago

#2685 reviewing defect

SymbolicExpressionGrammars calculate the min length and depth of expression wrong

Reported by: mkommend Owned by: mkommend
Priority: medium Milestone: HeuristicLab 3.3.15
Component: Encodings.SymbolicExpressionTreeEncoding Version: 3.3.14
Keywords: Cc:

Description (last modified by mkommend)

The calculation for the minimum and maximum expression length and depth based on the restrictions of the grammar (allowed child symbols) returns wrong results if the symbols are nested recursively.

The attached script reproduces the problem. Thanks to sforsten for reporting this problem.

Attachments (2)

Grammar.png (9.0 KB) - added by mkommend 5 months ago.
Visualization of the grammar
Script Grammar Expression Length Test.hl (1.4 KB) - added by mkommend 5 months ago.
Script to reproduce the problem

Download all attachments as: .zip

Change History (14)

comment:1 Changed 5 months ago by mkommend

  • Status changed from new to accepted

Changed 5 months ago by mkommend

Visualization of the grammar

Changed 5 months ago by mkommend

Script to reproduce the problem

comment:2 Changed 5 months ago by mkommend

  • Description modified (diff)

comment:3 Changed 5 months ago by mkommend

r14340: Added ctor to simple symbol.

comment:4 Changed 5 months ago by mkommend

r14341: Added unit test for min expression length and depth of configured grammars.

comment:5 Changed 5 months ago by mkommend

r14342: Refactored calculation of minimum expression length and depth into an separate class. Removed separate initialization code for the grammar caches in the ctor.

comment:6 Changed 5 months ago by bburlacu

  • Owner changed from mkommend to bburlacu
  • Status changed from accepted to assigned

comment:7 Changed 5 months ago by bburlacu

  • Status changed from assigned to accepted

comment:8 Changed 5 months ago by bburlacu

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

r14352: Refactored length and depth calculation and updated unit tests.

comment:9 Changed 5 months ago by bburlacu

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

comment:10 Changed 5 months ago by bburlacu

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

r14353: Accidental commit.

r14354: Revert accidental commit.

r14355: Add correction step to account for grammar cycles. Update unit test.

Last edited 5 months ago by bburlacu (previous) (diff)

comment:11 Changed 5 months ago by bburlacu

r14356: Fix exception with symbols with no children (sequence contains no elements), factor out common code in separate methods.

Last edited 5 months ago by bburlacu (previous) (diff)

comment:12 Changed 5 months ago by bburlacu

r14357: Minor refactor.

Note: See TracTickets for help on using tickets.