@ Override public boolean beforeSolve ( ReconfigurationProblem p ) throws SchedulerException { for ( VM vm : source . getMapping ( ) . getAllVMs ( ) ) { int vmId = p . getVM ( vm ) ; int v = getVMAllocation ( vmId ) ; if ( v < 0 ) { int prevUsage = rc . getConsumption ( vm ) ; minVMAllocation ( vmId , prevUsage ) ; } } ChocoView v = rp . getView ( Packing . VIEW_ID ) ; if ( v == null ) { throw SchedulerModelingException . missingView ( rp . getSourceModel ( ) , Packing . VIEW_ID ) ; } IntVar [ ] host = new IntVar [ p . getFutureRunningVMs ( ) . size ( ) ] ; int [ ] demand = new int [ host . length ] ; int i = 0 ; for ( VM vm : p . getFutureRunningVMs ( ) ) { host [ i ] = rp . getVMAction ( vm ) . getDSlice ( ) . getHoster ( ) ; demand [ i ] = getVMAllocation ( p . getVM ( vm ) ) ; i ++ ; } ( ( Packing ) v ) . addDim ( rc . getResourceIdentifier ( ) , virtRcUsage , demand , host ) ; return linkVirtualToPhysicalUsage ( ) ; }
Set the resource usage for each of the VM . If the LB is < 0 the previous consumption is used to maintain the resource usage . Otherwise the usage is set to the variable lower bound .