trunk/chuffed/globals/cumulativeCalendar.c
// Minimal energy of task i
// TTEF_cal: We could consider min_execution_time here, but computation is expensive
Minimal energy of task i
TTEF_cal: We could consider min_execution_time here, but computation is expensive
Minimal energy of task i TTEF_cal : We could consider min_execution_time here but computation is expensive
inline CUMU_INT
	min_energy(CUMU_INT i) { 
		if(rho == 0) {  
			return min_usage(i) * min_dur(i); 
		}else{ 
			int duration = min_dur(i);
			int t = est(i);
			int ls = lst(i);
			int distance = lct(i) - t;
			int j, tau, next;
			while(t <= ls) {
				tau = t;
				j = 0;
				next = ls+1;
				while(j < duration){
					if(calendar[taskCalendar[i]-1][t]==1) { 
						j++; 
					}else if(calendar[taskCalendar[i]-1][t+1]==1) {
						next = min(next, t+1);
					}
					t++;
				}
				distance = min(distance, t - tau);
				if(distance == duration) return min_usage(i) * duration;
				t = next;
			}
			return min_usage(i) * distance;
		}
	}
inline CUMU_INT min_energy ( CUMU_INT i ) { if ( rho == 0 ) { return min_usage ( i ) * min_dur ( i ) ; } else { int duration = min_dur ( i ) ; int t = est ( i ) ; int ls = lst ( i ) ; int distance = lct ( i ) - t ; int j , tau , next ; while ( t <= ls ) { tau = t ; j = 0 ; next = ls + 1 ; while ( j < duration ) { if ( calendar [ taskCalendar [ i ] - 1 ] [ t ] == 1 ) { j ++ ; } else if ( calendar [ taskCalendar [ i ] - 1 ] [ t + 1 ] == 1 ) { next = min ( next , t + 1 ) ; } t ++ ; } distance = min ( distance , t - tau ) ; if ( distance == duration ) return min_usage ( i ) * duration ; t = next ; } return min_usage ( i ) * distance ; } }
Minimal energy of task i
TTEF_cal: We could consider min_execution_time here, but computation is expensive
Minimal energy of task i TTEF_cal : We could consider min_execution_time here but computation is expensive
// TTEF_cal: resource is used exactly for p_i time units // TTEF_cal: resource stays engaged during breaks / could be used more than p_i time units 