public void prepare ( int values , FldExporter . ScopeOfValues scope ) { if ( engine == null ) { throw new RuntimeException ( "[benchmark error] engine not set before " + "preparing for values and scope" ) ; } int resolution ; if ( scope == FldExporter . ScopeOfValues . AllVariables ) { resolution = - 1 + ( int ) Math . max ( 1.0 , Math . pow ( values , 1.0 / engine . numberOfInputVariables ( ) ) ) ; } else { //if (type == EachVariable resolution = values - 1 ; } int [ ] sampleValues = new int [ engine . numberOfInputVariables ( ) ] ; int [ ] minSampleValues = new int [ engine . numberOfInputVariables ( ) ] ; int [ ] maxSampleValues = new int [ engine . numberOfInputVariables ( ) ] ; for ( int i = 0 ; i < engine . numberOfInputVariables ( ) ; ++ i ) { sampleValues [ i ] = 0 ; minSampleValues [ i ] = 0 ; maxSampleValues [ i ] = resolution ; } this . expected = new ArrayList < double [ ] > ( ) ; do { double [ ] expectedValues = new double [ engine . numberOfInputVariables ( ) ] ; for ( int i = 0 ; i < engine . numberOfInputVariables ( ) ; ++ i ) { InputVariable inputVariable = engine . getInputVariable ( i ) ; expectedValues [ i ] = inputVariable . getMinimum ( ) + sampleValues [ i ] * inputVariable . range ( ) / Math . max ( 1 , resolution ) ; } this . expected . add ( expectedValues ) ; } while ( Op . increment ( sampleValues , minSampleValues , maxSampleValues ) ) ; }
Produces and loads into memory the set of expected values from the engine