src/smt/theory_jobscheduler.cpp
/**
     *  Ensure that job overlaps don't exceed available energy
     */
Ensure that job overlaps don't exceed available energy
Ensure that job overlaps don ' t exceed available energy
bool theory_jobscheduler::constrain_resource_energy(unsigned r) {
        bool blocked = false;
        vector<job_time> starts, ends;
        res_info const& ri = m_resources[r];
        for (unsigned j : ri.m_jobs) {
            if (resource(j) == r) {
                starts.push_back(job_time(j, start(j)));
                ends.push_back(job_time(j, end(j)));
            }
        }
        job_overlap overlap(starts, ends);
        while (overlap.next()) {
            unsigned cap = 0;
            auto const& jobs = overlap.jobs();
            for (auto j : jobs) {
                cap += get_job_resource(j, r).m_loadpct;
                if (cap > 100) {
                    block_job_overlap(r, jobs, j);
                    blocked = true;
                    goto try_next_overlap;
                }
            }    
        try_next_overlap:
            ;
        }
        return blocked;
    }
bool theory_jobscheduler :: constrain_resource_energy ( unsigned r ) { bool blocked = false ; vector < job_time > starts , ends ; res_info const & ri = m_resources [ r ] ; for ( unsigned j : ri . m_jobs ) { if ( resource ( j ) == r ) { starts . push_back ( job_time ( j , start ( j ) ) ) ; ends . push_back ( job_time ( j , end ( j ) ) ) ; } } job_overlap overlap ( starts , ends ) ; while ( overlap . next ( ) ) { unsigned cap = 0 ; auto const & jobs = overlap . jobs ( ) ; for ( auto j : jobs ) { cap += get_job_resource ( j , r ) . m_loadpct ; if ( cap > 100 ) { block_job_overlap ( r , jobs , j ) ; blocked = true ; goto try_next_overlap ; } } try_next_overlap : ; } return blocked ; }
Ensure that job overlaps don't exceed available energy
Ensure that job overlaps don ' t exceed available energy