I’m trying to learn optimization alongside JuMP syntax, and as a toy problem, I’m trying an integer based problem, in which I have a variable y, with decision variables x (in [0,1]), and I want to be able to optimize such that the decision variables are uniformly spread through the domain of y.
m = Model();
y = collect(1.0:1.0:100);
n = length(y);
@variable(m, x[1:n], Bin);
@constraint(m, sum(x) == 10);
Any ideas about what the best objective would be for this, and the accompanying best (preferably open source) solver?
Thanks! This is just what I needed - I was thinking of using the differences between adjacent points, but wasn’t sure how to implement. If it wasn’t sorted (which may be the case if I’m trying to optimize over multiple variables), could I just compute a vector of ranks and use that instead?