ns-allinone-2.35/queue/red.cc
void REDQueue::updateMaxP(double new_ave, double now)
{
	double part = 0.4*(edp_.th_max - edp_.th_min);
	// AIMD rule to keep target Q~1/2(th_min+th_max)
	if ( new_ave < edp_.th_min + part && edv_.cur_max_p > edp_.bottom) {
		// we increase the average queue size, so decrease max_p
		edv_.cur_max_p = edv_.cur_max_p * edp_.beta;
		edv_.lastset = now;
	} else if (new_ave > edp_.th_max - part && edp_.top > edv_.cur_max_p ) {
		// we decrease the average queue size, so increase max_p
		double alpha = edp_.alpha;
                        if ( alpha > 0.25*edv_.cur_max_p )
			alpha = 0.25*edv_.cur_max_p;
		edv_.cur_max_p = edv_.cur_max_p + alpha;
		edv_.lastset = now;
	} 
}
/*
 *  Updating max_p to keep the average queue size within the target range.
 *  This is only called for Adaptive RED.
 */
Updating max_p to keep the average queue size within the target range.
This is only called for Adaptive RED.
Updating max_p to keep the average queue size within the target range . This is only called for Adaptive RED .
void REDQueue::updateMaxP(double new_ave, double now)
{
	double part = 0.4*(edp_.th_max - edp_.th_min);
	if ( new_ave < edp_.th_min + part && edv_.cur_max_p > edp_.bottom) {
		edv_.cur_max_p = edv_.cur_max_p * edp_.beta;
		edv_.lastset = now;
	} else if (new_ave > edp_.th_max - part && edp_.top > edv_.cur_max_p ) {
		double alpha = edp_.alpha;
                        if ( alpha > 0.25*edv_.cur_max_p )
			alpha = 0.25*edv_.cur_max_p;
		edv_.cur_max_p = edv_.cur_max_p + alpha;
		edv_.lastset = now;
	} 
}
void REDQueue :: updateMaxP ( double new_ave , double now ) { double part = 0.4 * ( edp_ . th_max - edp_ . th_min ) ; if ( new_ave < edp_ . th_min + part && edv_ . cur_max_p > edp_ . bottom ) { edv_ . cur_max_p = edv_ . cur_max_p * edp_ . beta ; edv_ . lastset = now ; } else if ( new_ave > edp_ . th_max - part && edp_ . top > edv_ . cur_max_p ) { double alpha = edp_ . alpha ; if ( alpha > 0.25 * edv_ . cur_max_p ) alpha = 0.25 * edv_ . cur_max_p ; edv_ . cur_max_p = edv_ . cur_max_p + alpha ; edv_ . lastset = now ; } }
Updating max_p to keep the average queue size within the target range.
Updating max_p to keep the average queue size within the target range .
// AIMD rule to keep target Q~1/2(th_min+th_max) // we increase the average queue size, so decrease max_p // we decrease the average queue size, so increase max_p