src/smt/theory_jobscheduler.cpp
/**
     * Compute last start time for job on resource r.
     */
Compute last start time for job on resource r.
Compute last start time for job on resource r .
bool theory_jobscheduler::lst(unsigned j, unsigned r, time_t& start) {
        start = 0;
        job_resource const& jr = get_job_resource(j, r);
        vector<res_available>& available = m_resources[r].m_available;
        unsigned j_load_pct = jr.m_loadpct;
        time_t cap = jr.m_capacity;
        for (unsigned idx = available.size(); idx-- > 0; ) {
            if (!resource_available(jr, available[idx])) continue;
            start    = available[idx].m_start;
            time_t end      = available[idx].m_end;
            unsigned load_pct = available[idx].m_loadpct;
            time_t delta = solve_for_capacity(load_pct, j_load_pct, start, end);
            if (delta > cap) {
                start = solve_for_start(load_pct, j_load_pct, end, cap);
                cap = 0;
            }
            else {
                cap -= delta;
            }
            if (cap == 0) {
                return true;
            }
        }
        return false;
    }
bool theory_jobscheduler :: lst ( unsigned j , unsigned r , time_t & start ) { start = 0 ; job_resource const & jr = get_job_resource ( j , r ) ; vector < res_available > & available = m_resources [ r ] . m_available ; unsigned j_load_pct = jr . m_loadpct ; time_t cap = jr . m_capacity ; for ( unsigned idx = available . size ( ) ; idx -- > 0 ; ) { if ( ! resource_available ( jr , available [ idx ] ) ) continue ; start = available [ idx ] . m_start ; time_t end = available [ idx ] . m_end ; unsigned load_pct = available [ idx ] . m_loadpct ; time_t delta = solve_for_capacity ( load_pct , j_load_pct , start , end ) ; if ( delta > cap ) { start = solve_for_start ( load_pct , j_load_pct , end , cap ) ; cap = 0 ; } else { cap -= delta ; } if ( cap == 0 ) { return true ; } } return false ; }
Compute last start time for job on resource r.
Compute last start time for job on resource r .