core-api/src/main/java/org/arrowhead/wp5/core/entities/FlexOfferSchedule.java
public void fixNumericalErrors(FlexOffer flexOffer) {
		final double EPSILON = 1e-4;
		
		if ((this.getEnergyAmounts() != null) && (this.getEnergyAmounts().length == flexOffer.getSlices().length)){
			for (int i = 0; i < this.getEnergyAmounts().length; i++) {
				/* Check and fix lower bound */
				if (this.getEnergyAmounts()[i] < flexOffer.getSlices()[i].getEnergyLower() && 
				    this.getEnergyAmounts()[i] > flexOffer.getSlices()[i].getEnergyLower() - EPSILON) {
					this.getEnergyAmounts()[i] = flexOffer.getSlices()[i].getEnergyLower();
				}
				
				/* Check and fix lower bound */
				if (this.getEnergyAmounts()[i] > flexOffer.getSlices()[i].getEnergyUpper() && 
					this.getEnergyAmounts()[i] < flexOffer.getSlices()[i].getEnergyUpper() + EPSILON) {
					this.getEnergyAmounts()[i] = flexOffer.getSlices()[i].getEnergyUpper();
				}
			}
		}
	}
/**
	 * Fix small numerical errors in the schedule 
	 */
Fix small numerical errors in the schedule
Fix small numerical errors in the schedule
public void fixNumericalErrors(FlexOffer flexOffer) {
		final double EPSILON = 1e-4;
		if ((this.getEnergyAmounts() != null) && (this.getEnergyAmounts().length == flexOffer.getSlices().length)){
			for (int i = 0; i < this.getEnergyAmounts().length; i++) {
				/* Check and fix lower bound */
				if (this.getEnergyAmounts()[i] < flexOffer.getSlices()[i].getEnergyLower() && 
				    this.getEnergyAmounts()[i] > flexOffer.getSlices()[i].getEnergyLower() - EPSILON) {
					this.getEnergyAmounts()[i] = flexOffer.getSlices()[i].getEnergyLower();
				}
				/* Check and fix lower bound */
				if (this.getEnergyAmounts()[i] > flexOffer.getSlices()[i].getEnergyUpper() && 
					this.getEnergyAmounts()[i] < flexOffer.getSlices()[i].getEnergyUpper() + EPSILON) {
					this.getEnergyAmounts()[i] = flexOffer.getSlices()[i].getEnergyUpper();
				}
			}
		}
	}
public void fixNumericalErrors ( FlexOffer flexOffer ) { final double EPSILON = 1e-4 ; if ( ( this . getEnergyAmounts ( ) != null ) && ( this . getEnergyAmounts ( ) . length == flexOffer . getSlices ( ) . length ) ) { for ( int i = 0 ; i < this . getEnergyAmounts ( ) . length ; i ++ ) { /* Check and fix lower bound */ if ( this . getEnergyAmounts ( ) [ i ] < flexOffer . getSlices ( ) [ i ] . getEnergyLower ( ) && this . getEnergyAmounts ( ) [ i ] > flexOffer . getSlices ( ) [ i ] . getEnergyLower ( ) - EPSILON ) { this . getEnergyAmounts ( ) [ i ] = flexOffer . getSlices ( ) [ i ] . getEnergyLower ( ) ; } /* Check and fix lower bound */ if ( this . getEnergyAmounts ( ) [ i ] > flexOffer . getSlices ( ) [ i ] . getEnergyUpper ( ) && this . getEnergyAmounts ( ) [ i ] < flexOffer . getSlices ( ) [ i ] . getEnergyUpper ( ) + EPSILON ) { this . getEnergyAmounts ( ) [ i ] = flexOffer . getSlices ( ) [ i ] . getEnergyUpper ( ) ; } } } }
Fix small numerical errors in the schedule
Fix small numerical errors in the schedule