#include <BCP_process.hpp>
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) |
Definition at line 49 of file BCP_process.hpp.
BCP_scheduler::BCP_scheduler | ( | ) |
Default constructor.
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.
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. |
void BCP_scheduler::add_free_ids | ( | int | numIds, | |
const int * | ids | |||
) |
Pass in a list of freeIds_ to add.
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.
numIds | : number of ids requested | |
ids | : filled vector with the number of ids served. |
void BCP_scheduler::release_sb_id | ( | int | id | ) |
Gives back to scheduler an id used for strong branching.
int BCP_scheduler::request_node_id | ( | ) |
Request an id for processing nodes.
void BCP_scheduler::release_node_id | ( | int | id | ) |
Give back an id to scheduler used for processing a 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_.
int BCP_scheduler::numNodeIds | ( | ) | const [inline] |
Return the number of busy LP processes.
Definition at line 95 of file BCP_process.hpp.
References numNodeIds_.
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_.
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_.
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_.
void BCP_scheduler::update_idle_times | ( | ) |
Update idle times with the last idle time.
int BCP_scheduler::max_id_allocation | ( | int | numIds | ) | [private] |
Compute max allowed allocation of CPUs.
void BCP_scheduler::update_rates | ( | int | add_req, | |
int | add_rel | |||
) | [private] |
Update the counts and the static_ flag.
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 sb_idle().
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 node_idle().
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.
std::map<int, double> BCP_scheduler::last_release_time_ [private] |
int BCP_scheduler::totalNumberIds_ [private] |
std::vector<int> BCP_scheduler::freeIds_ [private] |
List of free CPUs ids.
Definition at line 131 of file BCP_process.hpp.
Referenced by has_free_node_id().
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(), and numNodeIds().
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 has_free_node_id(), and maxNodeIds().
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.
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.
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.
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.
double BCP_scheduler::rho_static_ [private] |
double BCP_scheduler::switch_thresh_ [private] |
percentage threshold to swtich to rate-based strategy
Definition at line 153 of file BCP_process.hpp.
int BCP_scheduler::numSecRateInterval_ [private] |
Number of seconds in time horizon for rate computation.
Definition at line 155 of file BCP_process.hpp.
std::vector<int> BCP_scheduler::request_counts_ [private] |
int BCP_scheduler::request_counts_tot_ [private] |
total number of requests in considered time interval
Definition at line 159 of file BCP_process.hpp.
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.
int BCP_scheduler::release_counts_tot_ [private] |
total number of releases in considered time interval
Definition at line 163 of file BCP_process.hpp.
int BCP_scheduler::counts_ptr_ [private] |
time_t BCP_scheduler::time_last_action_ [private] |
double BCP_scheduler::rho_rate_ [private] |
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.
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.