@ Override public void postCostConstraints ( ) { if ( ! costActivated ) { costActivated = true ; rp . getLogger ( ) . debug ( "Post the cost-oriented constraints" ) ; List < IntVar > mttrs = Stream . concat ( rp . getVMActions ( ) . stream ( ) , rp . getNodeActions ( ) . stream ( ) ) . map ( Transition :: getEnd ) . collect ( Collectors . toList ( ) ) ; rp . getModel ( ) . post ( rp . getModel ( ) . sum ( mttrs . toArray ( new IntVar [ 0 ] ) , "=" , cost ) ) ; } }
Post the constraints related to the objective .