[ojAlgo-user] ExpressionsBasedModel and absolute constraints
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anthony E. <ant...@al...> - 2015-02-16 12:21:32
|
Hi I am using an expressions based model (for a portfolio optimisation problem) and can add a constraint such that the sum of the weights in the portfolio is equals to 1 as follows: Expression balanceExpr = model.addExpression("Balance"); for (int i=0; i<ers.length; i++) balanceExpr.setLinearFactor(i, BigMath.ONE); balanceExpr.lower(BigMath.ONE); balanceExpr.upper(BigMath.ONE); What I would like to do is add another constrains such that the sum of the absolute values of the weights is less than 2. Any idea how I can do this? There is no setAbsoluteValueLinearFactor function or any way of doing this as far as I can see. Any pointers would be gratefully appreciated! Thanks Tony |