| 59 | } |
| 60 | |
| 61 | bool eval_solution( |
| 62 | const MySolution& p, |
| 63 | MyMiddleCost &c) |
| 64 | { |
| 65 | double x=p.x; |
| 66 | double y=p.y; |
| 67 | // see the surface plot at: |
| 68 | // 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 |
| 69 | // |
| 70 | // the middle comupations of cost: |
| 71 | if(x+y>0) |
| 72 | { |
| 73 | double predictable_noise=30.0*sin(x*100.0*sin(y)+y*100.0*cos(x)); |
| 74 | c.cost_distance2=x*x+y*y+predictable_noise; |
| 75 | c.cost_sqsin=125+45.0*sqrt(x+y)*sin((15.0*(x+y))/(x*x+y*y)); |
| 76 | return true; // genes are accepted |
| 77 | } |
| 78 | else |
| 79 | return false; // genes are rejected |
| 80 | } |
| 81 | |
| 82 | MySolution mutate( |
| 83 | const MySolution& X_base, |
nothing calls this directly
no outgoing calls
no test coverage detected