library( data.table )
N <- 10
utilities <- data.table( id = 1:N,
u1 = runif( N, 0, 1 ),
u2 = runif( N, 0, 1 ),
u3 = runif( N, 0, 1 ),
u4 = runif( N, 0, 1 ) )
n <- 100
alpha <- c( 0.2, 0.5, 0.1, 0.2 )
constraints <- list( list( c(1,2), 0.7 ),
list( c(3,4), 0.3 ) )
S <- sim_const_weights( n, utilities, alpha, constraints )
plot.S <- plot_sim_weight( S$simulation, title = 'Simulations',
xlab = 'ID', ylab = 'Utility' )
plot( plot.S )
Run the code above in your browser using DataLab