| 38 | } |
| 39 | |
| 40 | bool eval_solution( |
| 41 | const MySolution& p, |
| 42 | MyMiddleCost &c) |
| 43 | { |
| 44 | double x=p.x; |
| 45 | double y=p.y; |
| 46 | // see the surface plot at: |
| 47 | // https://academo.org/demos/3d-surface-plotter/?expression=x*x%2By*y%2B30.0*sin(x*100.0*sin(y)%2By*100.0*cos(x))%2B125%2B45.0*sqrt(x%2By)*sin((15.0*(x%2By))%2F(x*x%2By*y))&xRange=-10%2C%2B10&yRange=-10%2C%2B10&resolution=100 |
| 48 | // |
| 49 | // the middle comupations of cost: |
| 50 | if(x+y>0) |
| 51 | { |
| 52 | double predictable_noise=30.0*sin(x*100.0*sin(y)+y*100.0*cos(x)); |
| 53 | c.cost_distance2=x*x+y*y+predictable_noise; |
| 54 | c.cost_sqsin=125+45.0*sqrt(x+y)*sin((15.0*(x+y))/(x*x+y*y)); |
| 55 | return true; // genes are accepted |
| 56 | } |
| 57 | else |
| 58 | return false; // genes are rejected |
| 59 | } |
| 60 | |
| 61 | MySolution mutate( |
| 62 | const MySolution& X_base, |
no outgoing calls
no test coverage detected