private boolean capHosting ( int nIdx , int min , int nbZeroes ) { Node n = rp . getNode ( nIdx ) ; double capa = getSourceResource ( ) . getCapacity ( n ) * getOverbookRatio ( nIdx ) /*.getLB()*/ ; int card = ( int ) ( capa / min ) + nbZeroes + 1 ; if ( card < source . getMapping ( ) . getRunningVMs ( n ) . size ( ) ) { // This shortcut is required to prevent a filtering issue in the scheduling phase: // At time 0, LocalTaskScheduler will complain and start to backtrack. // TODO: revise the notion of continuous constraint for the cardinality issue. return true ; } try { //Restrict the hosting capacity. rp . getNbRunningVMs ( ) . get ( nIdx ) . updateUpperBound ( card , Cause . Null ) ; } catch ( ContradictionException ex ) { rp . getLogger ( ) . error ( "Unable to cap the hosting capacity of '" + n + " ' to " + card , ex ) ; return false ; } return true ; }
Reduce the cardinality wrt . the worst case scenario .