12 #include "CoinTime.hpp"
15 #ifndef BCP_DEBUG_PRINT
16 #define BCP_DEBUG_PRINT 0
30 double SwitchToRateThreshold,
31 double TimeRootNodeSolve,
32 double FactorTimeHorizon,
33 double OverEstimationRate,
34 double MaxNodeIdRatio,
73 const double t = CoinWallclockTime();
74 for (
int i = 0; i < numIds; ++i) {
91 #if (BCP_DEBUG_PRINT != 0)
93 printf(
"SC static: req: %i given: %i total: %i node(max): %i(%i) free: %i minSb: %i maxSb: %i rho: %lf\n",
97 printf(
"SC rate: req: %i given: %i total: %i node(max): %i(%i) free: %i minSb: %i maxSb: %i rho: %lf rel_cnt: %i req_cnt: %i\n",
103 if (numIds==0)
return 0;
105 const int newsize =
freeIds_.size() - numIds;
106 CoinDisjointCopyN(&
freeIds_[newsize], numIds, ids);
108 const double t = CoinWallclockTime();
109 for (
int i = 0; i < numIds; ++i) {
110 const int id = ids[i];
160 const double t = CoinWallclockTime();
161 for (
int i =
freeIds_.size()-1; i >= 0; --i) {
178 time_t time_now = time(NULL);
225 const int numFree =
freeIds_.size();
243 retval = CoinMin(numFree, (
int)floor(dretval));
253 if (retval && (retval & 1) == 0) {
bool static_
flag indicating whether we are in the static or the rate-based phase
int maxSbIds_
Upper threshold for IDs returned at a request.
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.
int maxNodeIdNum_
At most this many ids can be used as a nodeid.
int numNodeIds_
number of lp ids served.
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
void update_idle_times()
Update idle times with the last idle time.
double maxNodeIdRatio_
At most this fraction of the total number of ids can be used as a nodeid.
int request_counts_tot_
total number of requests in considered time interval
int numSecRateInterval_
Number of seconds in time horizon for rate computation.
std::map< int, double > last_release_time_
when was the process release last time
void add_free_ids(int numIds, const int *ids)
Pass in a list of freeIds_ to add.
int minSbIds_
Lower threshold for IDs returned at a request.
int request_sb_ids(int numIds, int *ids)
Request for a number of id's to do some strong branching.
time_t time_last_action_
Time stamp of last request or release.
double rho_static_
overestimation factor for static strategy
int counts_ptr_
Array counter.
int request_node_id()
Request an id for processing nodes.
BCP_scheduler()
Default constructor.
int max_id_allocation(int numIds)
Compute max allowed allocation of CPUs.
void release_sb_id(int id)
Gives back to scheduler an id used for strong branching.
std::vector< int > freeIds_
List of free CPUs ids.
std::map< int, double > last_release_type_
the type of the last release (0: algo start, 1: from SB, 2: from node
double switch_thresh_
percentage threshold to swtich to rate-based strategy
int release_counts_tot_
total number of releases in considered time interval
int totalNumberIds_
Store the total number of CPUs.
double rho_rate_
overestimation factor for rate-based strategy
int maxNodeIds_
The maximum number of lp ids that can be served.
bool have_rates_
flag indicating whether we have rate information (i.e., the time horizon has passed at least once) ...
void update_rates(int add_req, int add_rel)
Update the counts and the static_ flag.
std::vector< int > release_counts_
vector for counting released sb id requests per time unit
void release_node_id(int id)
Give back an id to scheduler used for processing a node.
std::vector< int > request_counts_
vector for counting id requests per time unit