I have used CVXOPT to run an optimisation problem. Although I like result I am trying to get rid of negligible weights from the optimal solution but I also would like to have the sum of w=1.
How can I constraint the optimiser for an allowed min trade size? where for min size do not intend min weight i.e. if x <> 0 and x < y then x = 0 else x = x
Or is there a way to have an output which will not consider (and iterate the optimisation) if w < x ?
There are two different reasons for small allocations.
(1) Each solver uses tolerances. This can even allow tiny negative weights. Interior point solvers often deliver solutions where allocations are not 0 but a very small number. That is because of the nature of the algorithm (they want to stay in the interior of the feasible region). Usually active set algorithms give "nicer" solutions (with real zeros) than interior point or first order algorithms. In general the tolerances are so small that this can be repaired by rounding a bit after the solve. Some advanced solvers may do a cross-over at the end to clean up solutions (technical term: find a basic solution instead of an interior solution). This is small stuff, and is probably not what you are complaining about.
(2) QP solutions often use a lot of instruments, with a lot of small weights. We can at the modeling level prevent this by saying: instrument i can be 0 or larger than a lower bound (say 5%). This can be modeled with so-called semi-continuous variables (or binary variables). The model becomes an MIQP model (I don't think CVXOPT has a MIQP solver, but solvers like Cplex and Gurobi include MIQP capabilities). Another approach is to explicitly model transaction costs, which will also prohibit very small allocations. Furthermore, LAD (Least Absolute Deviations) models tend to generate fewer small allocations than quadratic models.
Note: a heuristic approach when MIQP capabilities are missing is shown here.