BCP_scheduler Class Reference

#include <BCP_process.hpp>

List of all members.

Public Member Functions

 BCP_scheduler ()
 Default constructor.
void setParams (double OverEstimationStatic, double SwitchToRateThreshold, double TimeRootNodeSolve, double FactorTimeHorizon, double OverEstimationRate, double MaxNodeIdRatio, int MaxNodeIdNum, int MaxSbIdNum, int MinSbIdNum)
 Method for setting scheduler parameters.
void add_free_ids (int numIds, const int *ids)
 Pass in a list of freeIds_ to add.
int request_sb_ids (int numIds, int *ids)
 Request for a number of id's to do some strong branching.
void release_sb_id (int id)
 Gives back to scheduler an id used for strong branching.
int request_node_id ()
 Request an id for processing nodes.
void release_node_id (int id)
 Give back an id to scheduler used for processing a node.
bool has_free_node_id () const
 Decide if there is an id that can be returned for processin a node.
int numNodeIds () const
 Return the number of busy LP processes.
int maxNodeIds () const
 Return the maximum possible number of busy LP processes.
double node_idle (int p)
 Return how much time did process p spent idling as a node process.
double sb_idle (int p)
 Return how much time did process p spent idling as a SB process.
void update_idle_times ()
 Update idle times with the last idle time.

Private Member Functions

int max_id_allocation (int numIds)
 Compute max allowed allocation of CPUs.
void update_rates (int add_req, int add_rel)
 Update the counts and the static_ flag.

Private Attributes

std::map< int, double > sb_idle_time_
 the SB idle time for each process
std::map< int, double > node_idle_time_
 the node idle time for each process
std::map< int, double > last_release_type_
 the type of the last release (0: algo start, 1: from SB, 2: from node
std::map< int, double > last_release_time_
 when was the process release last time
int totalNumberIds_
 Store the total number of CPUs.
std::vector< int > freeIds_
 List of free CPUs ids.
int numNodeIds_
 number of lp ids served.
int maxNodeIds_
 The maximum number of lp ids that can be served.
double maxNodeIdRatio_
 At most this fraction of the total number of ids can be used as a nodeid.
int maxNodeIdNum_
 At most this many ids can be used as a nodeid.
int maxSbIds_
 Upper threshold for IDs returned at a request.
int minSbIds_
 Lower threshold for IDs returned at a request.
double rho_static_
 overestimation factor for static strategy
double switch_thresh_
 percentage threshold to swtich to rate-based strategy
int numSecRateInterval_
 Number of seconds in time horizon for rate computation.
std::vector< int > request_counts_
 vector for counting id requests per time unit
int request_counts_tot_
 total number of requests in considered time interval
std::vector< int > release_counts_
 vector for counting released sb id requests per time unit
int release_counts_tot_
 total number of releases in considered time interval
int counts_ptr_
 Array counter.
time_t time_last_action_
 Time stamp of last request or release.
double rho_rate_
 overestimation factor for rate-based strategy
bool static_
 flag indicating whether we are in the static or the rate-based phase
bool have_rates_
 flag indicating whether we have rate information (i.e., the time horizon has passed at least once)


Detailed Description

Definition at line 49 of file BCP_process.hpp.


Constructor & Destructor Documentation

BCP_scheduler::BCP_scheduler (  ) 

Default constructor.

Definition at line 19 of file BCP_process.cpp.


Member Function Documentation

void BCP_scheduler::setParams ( double  OverEstimationStatic,
double  SwitchToRateThreshold,
double  TimeRootNodeSolve,
double  FactorTimeHorizon,
double  OverEstimationRate,
double  MaxNodeIdRatio,
int  MaxNodeIdNum,
int  MaxSbIdNum,
int  MinSbIdNum 
)

Method for setting scheduler parameters.

Parameters:
OverEstimationStatic,: Factor for providing more IDs in static strategy.
SwitchToRateThreshold,: When more than SwitchToRateThreshold times the number of strong-branching CPUs are busy, which to rate-based strategy.
TimeRootNodeSolve,: Time to solve root node NLP (in secs)
FactorTimeHorizon,: This number times TimeRootNodeSolve is used to compute the rates
OverEstimationRate,: Factor for providing more IDs in rate-based strategy.
MaxNodeIdRatio,: At most this fraction of the total number of ids can be used as a nodeid.
MaxNodeIdNum,: At most this many ids can be used as a nodeid.

Definition at line 29 of file BCP_process.cpp.

References counts_ptr_, have_rates_, maxNodeIdNum_, maxNodeIdRatio_, maxNodeIds_, maxSbIds_, minSbIds_, numSecRateInterval_, release_counts_, release_counts_tot_, request_counts_, request_counts_tot_, rho_rate_, rho_static_, static_, switch_thresh_, time_last_action_, and totalNumberIds_.

void BCP_scheduler::add_free_ids ( int  numIds,
const int *  ids 
)

Pass in a list of freeIds_ to add.

Definition at line 67 of file BCP_process.cpp.

References freeIds_, last_release_time_, last_release_type_, maxNodeIdNum_, maxNodeIdRatio_, maxNodeIds_, node_idle_time_, sb_idle_time_, and totalNumberIds_.

Referenced by BCP_tm_start_processes(), and BCP_single_environment::register_process().

int BCP_scheduler::request_sb_ids ( int  numIds,
int *  ids 
)

Request for a number of id's to do some strong branching.

NOTE: ids must be already allocated to be at least numIds size.

Parameters:
numIds : number of ids requested
ids : filled vector with the number of ids served.
Returns:
number of ids served.

Definition at line 85 of file BCP_process.cpp.

References freeIds_, last_release_time_, last_release_type_, max_id_allocation(), maxNodeIds_, maxSbIds_, minSbIds_, node_idle_time_, numNodeIds_, release_counts_tot_, request_counts_tot_, rho_rate_, rho_static_, sb_idle_time_, static_, totalNumberIds_, and update_rates().

Referenced by BCP_tm_provide_SB_processes().

void BCP_scheduler::release_sb_id ( int  id  ) 

Gives back to scheduler an id used for strong branching.

Definition at line 121 of file BCP_process.cpp.

References freeIds_, last_release_time_, last_release_type_, and update_rates().

Referenced by BCP_tm_prob::process_message().

int BCP_scheduler::request_node_id (  ) 

Request an id for processing nodes.

Returns:
id number or -1 if none is available.

Definition at line 135 of file BCP_process.cpp.

References freeIds_, maxNodeIds_, and numNodeIds_.

Referenced by BCP_tm_assign_processes(), and BCP_tm_balance_data().

void BCP_scheduler::release_node_id ( int  id  ) 

Give back an id to scheduler used for processing a node.

Definition at line 145 of file BCP_process.cpp.

References freeIds_, last_release_time_, last_release_type_, numNodeIds_, and update_rates().

Referenced by BCP_tm_free_procs_of_node().

bool BCP_scheduler::has_free_node_id (  )  const [inline]

Decide if there is an id that can be returned for processin a node.

Definition at line 91 of file BCP_process.hpp.

References freeIds_, maxNodeIds_, and numNodeIds_.

Referenced by BCP_tm_start_new_nodes().

int BCP_scheduler::numNodeIds (  )  const [inline]

Return the number of busy LP processes.

Definition at line 95 of file BCP_process.hpp.

References numNodeIds_.

Referenced by BCP_tm_do_one_phase(), and BCP_single_environment::register_process().

int BCP_scheduler::maxNodeIds (  )  const [inline]

Return the maximum possible number of busy LP processes.

Definition at line 99 of file BCP_process.hpp.

References maxNodeIds_.

Referenced by BCP_tm_balance_data().

double BCP_scheduler::node_idle ( int  p  )  [inline]

Return how much time did process p spent idling as a node process.

Definition at line 103 of file BCP_process.hpp.

References node_idle_time_.

Referenced by BCP_tm_wrapup().

double BCP_scheduler::sb_idle ( int  p  )  [inline]

Return how much time did process p spent idling as a SB process.

Definition at line 107 of file BCP_process.hpp.

References sb_idle_time_.

Referenced by BCP_tm_wrapup().

void BCP_scheduler::update_idle_times (  ) 

Update idle times with the last idle time.

Definition at line 158 of file BCP_process.cpp.

References freeIds_, last_release_time_, last_release_type_, node_idle_time_, and sb_idle_time_.

int BCP_scheduler::max_id_allocation ( int  numIds  )  [private]

Compute max allowed allocation of CPUs.

Definition at line 217 of file BCP_process.cpp.

References freeIds_, maxNodeIds_, maxSbIds_, minSbIds_, numNodeIds_, release_counts_tot_, request_counts_tot_, rho_rate_, rho_static_, static_, and totalNumberIds_.

Referenced by request_sb_ids().

void BCP_scheduler::update_rates ( int  add_req,
int  add_rel 
) [private]

Update the counts and the static_ flag.

Definition at line 175 of file BCP_process.cpp.

References counts_ptr_, freeIds_, have_rates_, numNodeIds_, numSecRateInterval_, release_counts_, release_counts_tot_, request_counts_, request_counts_tot_, static_, switch_thresh_, time_last_action_, and totalNumberIds_.

Referenced by release_node_id(), release_sb_id(), and request_sb_ids().


Member Data Documentation

std::map<int, double> BCP_scheduler::sb_idle_time_ [private]

the SB idle time for each process

Definition at line 121 of file BCP_process.hpp.

Referenced by add_free_ids(), request_sb_ids(), sb_idle(), and update_idle_times().

std::map<int, double> BCP_scheduler::node_idle_time_ [private]

the node idle time for each process

Definition at line 123 of file BCP_process.hpp.

Referenced by add_free_ids(), node_idle(), request_sb_ids(), and update_idle_times().

std::map<int, double> BCP_scheduler::last_release_type_ [private]

the type of the last release (0: algo start, 1: from SB, 2: from node

Definition at line 125 of file BCP_process.hpp.

Referenced by add_free_ids(), release_node_id(), release_sb_id(), request_sb_ids(), and update_idle_times().

std::map<int, double> BCP_scheduler::last_release_time_ [private]

when was the process release last time

Definition at line 127 of file BCP_process.hpp.

Referenced by add_free_ids(), release_node_id(), release_sb_id(), request_sb_ids(), and update_idle_times().

int BCP_scheduler::totalNumberIds_ [private]

Store the total number of CPUs.

Definition at line 129 of file BCP_process.hpp.

Referenced by add_free_ids(), max_id_allocation(), request_sb_ids(), setParams(), and update_rates().

std::vector<int> BCP_scheduler::freeIds_ [private]

List of free CPUs ids.

Definition at line 131 of file BCP_process.hpp.

Referenced by add_free_ids(), has_free_node_id(), max_id_allocation(), release_node_id(), release_sb_id(), request_node_id(), request_sb_ids(), update_idle_times(), and update_rates().

int BCP_scheduler::numNodeIds_ [private]

number of lp ids served.

Definition at line 133 of file BCP_process.hpp.

Referenced by has_free_node_id(), max_id_allocation(), numNodeIds(), release_node_id(), request_node_id(), request_sb_ids(), and update_rates().

int BCP_scheduler::maxNodeIds_ [private]

The maximum number of lp ids that can be served.

Definition at line 135 of file BCP_process.hpp.

Referenced by add_free_ids(), has_free_node_id(), max_id_allocation(), maxNodeIds(), request_node_id(), request_sb_ids(), and setParams().

double BCP_scheduler::maxNodeIdRatio_ [private]

At most this fraction of the total number of ids can be used as a nodeid.

Definition at line 139 of file BCP_process.hpp.

Referenced by add_free_ids(), and setParams().

int BCP_scheduler::maxNodeIdNum_ [private]

At most this many ids can be used as a nodeid.

This is a parameter to the class. The true max is stored in maxNodeIds_

Definition at line 142 of file BCP_process.hpp.

Referenced by add_free_ids(), and setParams().

int BCP_scheduler::maxSbIds_ [private]

Upper threshold for IDs returned at a request.

If more than that number are requested (and are available) we still return this many.

Definition at line 145 of file BCP_process.hpp.

Referenced by max_id_allocation(), request_sb_ids(), and setParams().

int BCP_scheduler::minSbIds_ [private]

Lower threshold for IDs returned at a request.

If less than that number are requested, we still return less.

Definition at line 148 of file BCP_process.hpp.

Referenced by max_id_allocation(), request_sb_ids(), and setParams().

double BCP_scheduler::rho_static_ [private]

overestimation factor for static strategy

Definition at line 151 of file BCP_process.hpp.

Referenced by max_id_allocation(), request_sb_ids(), and setParams().

double BCP_scheduler::switch_thresh_ [private]

percentage threshold to swtich to rate-based strategy

Definition at line 153 of file BCP_process.hpp.

Referenced by setParams(), and update_rates().

int BCP_scheduler::numSecRateInterval_ [private]

Number of seconds in time horizon for rate computation.

Definition at line 155 of file BCP_process.hpp.

Referenced by setParams(), and update_rates().

std::vector<int> BCP_scheduler::request_counts_ [private]

vector for counting id requests per time unit

Definition at line 157 of file BCP_process.hpp.

Referenced by setParams(), and update_rates().

int BCP_scheduler::request_counts_tot_ [private]

total number of requests in considered time interval

Definition at line 159 of file BCP_process.hpp.

Referenced by max_id_allocation(), request_sb_ids(), setParams(), and update_rates().

std::vector<int> BCP_scheduler::release_counts_ [private]

vector for counting released sb id requests per time unit

Definition at line 161 of file BCP_process.hpp.

Referenced by setParams(), and update_rates().

int BCP_scheduler::release_counts_tot_ [private]

total number of releases in considered time interval

Definition at line 163 of file BCP_process.hpp.

Referenced by max_id_allocation(), request_sb_ids(), setParams(), and update_rates().

int BCP_scheduler::counts_ptr_ [private]

Array counter.

Definition at line 165 of file BCP_process.hpp.

Referenced by setParams(), and update_rates().

time_t BCP_scheduler::time_last_action_ [private]

Time stamp of last request or release.

Definition at line 167 of file BCP_process.hpp.

Referenced by setParams(), and update_rates().

double BCP_scheduler::rho_rate_ [private]

overestimation factor for rate-based strategy

Definition at line 169 of file BCP_process.hpp.

Referenced by max_id_allocation(), request_sb_ids(), and setParams().

bool BCP_scheduler::static_ [private]

flag indicating whether we are in the static or the rate-based phase

Definition at line 172 of file BCP_process.hpp.

Referenced by max_id_allocation(), request_sb_ids(), setParams(), and update_rates().

bool BCP_scheduler::have_rates_ [private]

flag indicating whether we have rate information (i.e., the time horizon has passed at least once)

Definition at line 175 of file BCP_process.hpp.

Referenced by setParams(), and update_rates().


The documentation for this class was generated from the following files:
Generated on Tue Mar 30 03:11:36 2010 by  doxygen 1.4.7