@Override
	public AssetModelMonteCarloSimulationModel getCloneWithModifiedData(Map<String, Object> dataModified) {
		/*
		 * Determine the new model parameters from the provided parameter map.
		 */
		double	newInitialTime	= dataModified.get("initialTime") != null	? ((Number)dataModified.get("initialTime")).doubleValue() : getTime(0);
		double	newInitialValue	= dataModified.get("initialValue") != null	? ((Number)dataModified.get("initialValue")).doubleValue() : initialValue;
		double	newRiskFreeRate	= dataModified.get("riskFreeRate") != null	? ((Number)dataModified.get("riskFreeRate")).doubleValue() : model.getRiskFreeRate().getAverage();
		double	newVolatility	= dataModified.get("volatility") != null	? ((Number)dataModified.get("volatility")).doubleValue()	: model.getVolatility().getAverage();
		int		newSeed			= dataModified.get("seed") != null			? ((Number)dataModified.get("seed")).intValue()				: seed;

		/*
		 * Create a new model with the new model parameters
		 */
		BrownianMotion brownianMotion;
		if(dataModified.get("seed") != null) {
			// The seed has changed. Hence we have to create a new BrownianMotionLazyInit.
			brownianMotion = new BrownianMotionLazyInit(this.getTimeDiscretization(), 1, this.getNumberOfPaths(), newSeed);
		}
		else
		{
			// The seed has not changed. We may reuse the random numbers (Brownian motion) of the original model
			brownianMotion = (BrownianMotion)model.getProcess().getStochasticDriver();
		}

		double timeShift = newInitialTime - getTime(0);
		if(timeShift != 0) {
			ArrayList<Double> newTimes = new ArrayList<>();
			newTimes.add(newInitialTime);
			for(Double time : model.getProcess().getStochasticDriver().getTimeDiscretization()) {
				if(time > newInitialTime) {
					newTimes.add(time);
				}
			}
			TimeDiscretization newTimeDiscretization = new TimeDiscretizationFromArray(newTimes);
			brownianMotion = brownianMotion.getCloneWithModifiedTimeDiscretization(newTimeDiscretization);
		}
		MonteCarloProcessFromProcessModel process = new EulerSchemeFromProcessModel(brownianMotion);
		return new MonteCarloBlackScholesModel(newInitialValue, newRiskFreeRate, newVolatility, process);
	}
@ Override public AssetModelMonteCarloSimulationModel getCloneWithModifiedData ( Map < String , Object > dataModified ) { double newInitialTime = dataModified . get ( "initialTime" ) != null ? ( ( Number ) dataModified . get ( "initialTime" ) ) . doubleValue ( ) : getTime ( 0 ) ; double newInitialValue = dataModified . get ( "initialValue" ) != null ? ( ( Number ) dataModified . get ( "initialValue" ) ) . doubleValue ( ) : initialValue ; double newRiskFreeRate = dataModified . get ( "riskFreeRate" ) != null ? ( ( Number ) dataModified . get ( "riskFreeRate" ) ) . doubleValue ( ) : model . getRiskFreeRate ( ) . getAverage ( ) ; double newVolatility = dataModified . get ( "volatility" ) != null ? ( ( Number ) dataModified . get ( "volatility" ) ) . doubleValue ( ) : model . getVolatility ( ) . getAverage ( ) ; int newSeed = dataModified . get ( "seed" ) != null ? ( ( Number ) dataModified . get ( "seed" ) ) . intValue ( ) : seed ; BrownianMotion brownianMotion ; if ( dataModified . get ( "seed" ) != null ) { brownianMotion = new BrownianMotionLazyInit ( this . getTimeDiscretization ( ) , 1 , this . getNumberOfPaths ( ) , newSeed ) ; } else { brownianMotion = ( BrownianMotion ) model . getProcess ( ) . getStochasticDriver ( ) ; } double timeShift = newInitialTime - getTime ( 0 ) ; if ( timeShift != 0 ) { ArrayList < Double > newTimes = new ArrayList < > ( ) ; newTimes . add ( newInitialTime ) ; for ( Double time : model . getProcess ( ) . getStochasticDriver ( ) . getTimeDiscretization ( ) ) { if ( time > newInitialTime ) { newTimes . add ( time ) ; } } TimeDiscretization newTimeDiscretization = new TimeDiscretizationFromArray ( newTimes ) ; brownianMotion = brownianMotion . getCloneWithModifiedTimeDiscretization ( newTimeDiscretization ) ; } MonteCarloProcessFromProcessModel process = new EulerSchemeFromProcessModel ( brownianMotion ) ; return new MonteCarloBlackScholesModel ( newInitialValue , newRiskFreeRate , newVolatility , process ) ; }
/* (non-Javadoc)
@see net.finmath.montecarlo.assetderivativevaluation.AssetModelMonteCarloSimulationModel#getCloneWithModifiedData(java.util.Map)
@TODO THE METHOD NEED TO BE CHANGED. NEED