# commons-user mailing list archives

##### Site index · List index
Message view
Top
From Alexander SehlstrĂ¶m <alexan...@sehlstrom.se>
Subject Re: [math] Solving SLP problem
Date Thu, 07 Mar 2013 17:31:27 GMT
```Thomas,

Thanks for the suggested solution. Seams to do the job as it no longer throws errors.

How do I retrieve my resulting double[] s from the PointValuePair r = new SimplexSolver().optimize(...)?

/Alexander

7 mar 2013 kl. 17:37 skrev Thomas Neidhart <thomas.neidhart@gmail.com>:

> On Thu, Mar 7, 2013 at 5:13 PM, Alexander SehlstrĂ¶m
> <alexander@sehlstrom.se>wrote:
>
>> Hi,
>>
>> I wish to solve the following problem:
>>
>> /* Problem --------------------------------------------------------
>> * Starting from double[] s0, determine double[] s, the solution of:
>> *
>> *     | min   f' * s
>> *     |
>> *     | s.t.  s_l <= s <= s_u
>> *
>> * where double[] f has the same length as the double [] s.
>> *
>> * The double[] s_l and double[] s_u are lower and upper bounds of s,
>> * respectively.
>> * ----------------------------------------------------------------
>> */
>>
>> I have tried to understand what solution algorithm in Apache Commons Math
>> to use. I have tried the SimplexSolver, but it seams unable to handle
>> SimpleBounds and demands LinearConstraint which I do not have any.
>>
>> Any suggestions of how to use the library for this problem?
>
>
> Hi Alexander,
>
> you can also see your bounds as linear constraints:
>
> s_l <= s <= s_u is equivalent to
>
> linear constraint s_i >= s_l
> linear constraint s_i <= s_u
>
> where s_i is your respective entry in the s array.
>
> Hope this helps,
>
> Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org