coin-Bcp
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BCP_scheduler Class Reference

#include <BCP_process.hpp>

Public Member Functions

 BCP_scheduler ()
 Default constructor. More...
 
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. More...
 
void add_free_ids (int numIds, const int *ids)
 Pass in a list of freeIds_ to add. More...
 
int request_sb_ids (int numIds, int *ids)
 Request for a number of id's to do some strong branching. More...
 
void release_sb_id (int id)
 Gives back to scheduler an id used for strong branching. More...
 
int request_node_id ()
 Request an id for processing nodes. More...
 
void release_node_id (int id)
 Give back an id to scheduler used for processing a node. More...
 
bool has_free_node_id () const
 Decide if there is an id that can be returned for processin a node. More...
 
int numNodeIds () const
 Return the number of busy LP processes. More...
 
int maxNodeIds () const
 Return the maximum possible number of busy LP processes. More...
 
double node_idle (int p)
 Return how much time did process p spent idling as a node process. More...
 
double sb_idle (int p)
 Return how much time did process p spent idling as a SB process. More...
 
void update_idle_times ()
 Update idle times with the last idle time. More...
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 49 of file BCP_process.hpp.

Constructor & Destructor Documentation

BCP_scheduler::BCP_scheduler ( )

Default constructor.

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.
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.

Parameters
numIds: number of ids requested
ids: filled vector with the number of ids served.
Returns
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.

Returns
id number or -1 if none is available.
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.

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 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

when was the process release last time

Definition at line 127 of file BCP_process.hpp.

int BCP_scheduler::totalNumberIds_
private

Store the total number of CPUs.

Definition at line 129 of file BCP_process.hpp.

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

overestimation factor for static strategy

Definition at line 151 of file BCP_process.hpp.

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

vector for counting id requests per time unit

Definition at line 157 of file BCP_process.hpp.

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

Array counter.

Definition at line 165 of file BCP_process.hpp.

time_t BCP_scheduler::time_last_action_
private

Time stamp of last request or release.

Definition at line 167 of file BCP_process.hpp.

double BCP_scheduler::rho_rate_
private

overestimation factor for rate-based strategy

Definition at line 169 of file BCP_process.hpp.

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.


The documentation for this class was generated from the following file: