Re: [ojAlgo-user] How do I do this with oj-algo
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anders P. <an...@op...> - 2015-02-19 04:55:56
|
You cannot add constraints on absolute variable values. You have to rethink your model. Optimatika does NOT offer this kind of modelling help as a free service. /Anders > On 18 feb 2015, at 19:02, Anthony Edwards <ant...@al...> wrote: > > I have an expressions based model and would like to add a constraint > such that the sum of the absolute values of the variables is set to a > specific value/level. How do I formulate this in oj-algo? IOve been > looking at this for a while and cant see how to actually formulate this > in terms of an expression I can add to the model .... > > Any help very much appreciated! > > Thanks > > Tony > > > On 16/02/15 13:11, Anders Peterson wrote: >> This is a modelling question not directly related to ojAlgo, Strictly speaking you're off topic for this mailing list, but I'm leaning towards allowing it if the discussion context is "how do I do this with ojAlgo". I will however only participate if the discussion leads to more concrete questions regarding ojAlgo. >> >> /Anders >> >> >> >>> On 16 feb 2015, at 13:01, Anthony Edwards <ant...@al...> wrote: >>> >>> 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 >>> >>> ------------------------------------------------------------------------------ >>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server >>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards >>> with Interactivity, Sharing, Native Excel Exports, App Integration & more >>> Get technology previously reserved for billion-dollar corporations, FREE >>> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk >>> _______________________________________________ >>> ojAlgo-user mailing list >>> ojA...@li... >>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >>> >>> >> >> ------------------------------------------------------------------------------ >> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server >> from Actuate! Instantly Supercharge Your Business Reports and Dashboards >> with Interactivity, Sharing, Native Excel Exports, App Integration & more >> Get technology previously reserved for billion-dollar corporations, FREE >> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk >> _______________________________________________ >> ojAlgo-user mailing list >> ojA...@li... >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > |