Changeset 12014 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization.SymbReg/ExpressionCompiler.cs
- Timestamp:
- 02/16/15 09:14:38 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization.SymbReg/ExpressionCompiler.cs
r11972 r12014 17 17 // does not compile to IL it is only necessary to calculate gradients for parameter optimization 18 18 // Expr -> Term { ('+' | '-' | '^' ) Term } 19 // Term -> Fact { ('*' | '%' ) Fact }20 // Fact -> '!' Expr | '(' Expr ')' | Var | const 19 // Term -> Fact { ('*' | '%' | '/') Fact } 20 // Fact -> '!' Expr | '(' Expr ')' | Var | const | one 21 21 // Var -> 'a'..'z' 22 22 // const -> '0' .. '9' 23 // one -> | // pipe symbol for constant one instead of ERC 1 23 24 24 25 // constants are completely ignored, instead we introduce a multiplicative constant factor for each term and an additive constant term for each expression … … 94 95 if (f != null) factors.Add(f); 95 96 var curSy = CurSy(); 96 while (curSy == '*' || curSy == '%' ) {97 while (curSy == '*' || curSy == '%' || curSy == '/') { // division and protected division symbols are handled in the same way 97 98 if (curSy == '*') { 98 99 NewSy(); … … 134 135 r = variables[varIdx]; 135 136 NewSy(); 137 } else if (curSy == '|') { 138 // pipe symbol is used in the expressionextender to represent constant one (|/x). 139 // this is necessary because we also use symbols 0..9 as indices for ERCs 140 r = 1.0; 141 NewSy(); 136 142 } else if (curSy >= '0' && curSy <= '9') { 137 143 int o = (byte)curSy - (byte)'0';
Note: See TracChangeset
for help on using the changeset viewer.