1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | language Essence 1.3 $ Optimal Financial Portfolio Design $ $ Problem details available at http://www.csplib.org/Problems/prob065/ $ $ Essence model by Jean-Noël Monette $ $ Licenced under CC-BY-4.0 : http://creativecommons.org/licenses/by/4.0/ given v,b,r: int (1..) where r <= b letting Nums be domain int (1..b) letting rv be r*v letting rvmodb be rv % b letting floorrv be rv / b letting ceilrv be rv / b + toInt (rv % b != 0) letting num be (ceilrv*ceilrv*rvmodb+floorrv*floorrv*(b-rvmodb)-rv) letting denom be v*(v-1) letting lb_lambda be num / denom + toInt ( num % denom !=0) find opd : set ( size v) of set ( size r) of Nums find lambda : int (lb_lambda..v) minimising lambda such that forAll {i, j} subsetEq opd . |i intersect j| <= lambda |