forum.alglib.net
http://forum.alglib.net/

Optimizations: Are aggregated bound constraints possible?
http://forum.alglib.net/viewtopic.php?f=2&t=361
Page 1 of 1

Author:  crotundo [ Thu May 19, 2011 2:43 pm ]
Post subject:  Optimizations: Are aggregated bound constraints possible?

Actually, I am using the minBleic optimizer, where I can nicely set 1:1 boundary conditions.

Example: w1, w2, w3

w1 between 23 and 37% works
w2 between 15 and 85% works
w3 between 2 and 99% works
w1+w2+w3 = 100% works

But, in another example:

Is something like w1 + w2 between 7 and 21% possible with no other contraints at the single w-level?
Is it possible to have incomplete boundary limitation sets?

Thanks.

Author:  Sergey.Bochkanov [ Fri May 20, 2011 5:00 am ]
Post subject:  Re: Optimizations: Are aggregated bound constraints possible

You can achieve such result with linear constraints. In particular, 7%<=w1+w2<=21% can be rewritten as combination of two linear constraints:
w1+w2>=7%
w1+w2<=21%

You can set arbitrary combination of boundary and linear constraints, and you can use arbitrary numner of linear constraints (you can even have more constraints than variables). Does it solve your problem?

Author:  crotundo [ Fri May 20, 2011 6:41 am ]
Post subject:  Re: Optimizations: Are aggregated bound constraints possible

I am happy that it's possible, but I don't see how to solve my concrete problem:

Having ten weights w1 ... w10, I would like to define the following:

C1) w1 between 0 and 11%
C2) w2 between 29% and 79%
C3) sum of (w3, w4, w5, w6) between 8 and 21%, no constraints otherwise on w3 ... w6
C4) w7 between 6 and 18%
C5) sum of (w8 and w9) between 7 and 21%, no constraints otherwise on w8 ... w9
C6) w10 between 7 and 21%
C7) sum of all weights must be 100%
C8) All weights must be positive
C9) sum of (w2, w3, w4, w5, w7) <= 45%
C10) sum of (w9, w7, w6, w8) <= 58%

Without sum constraints, I just defined a combination of minbleic.setbc minbleic.setlc methods using all weights and that works fine, but how would the syntax look like for constraints of the C3 or C5 type, then?

Author:  Sergey.Bochkanov [ Fri May 20, 2011 7:56 am ]
Post subject:  Re: Optimizations: Are aggregated bound constraints possible

Maybe I don't understand something, but you can reformulate C3 as combination of two linear inequality constraints, which can be set by minbleic.setlc, as I told in my previous post. It will become

w3+w4+w5+w6>=8%
w3+w4+w5+w6<=21%

Such pair of linear constraints won't influence individual weights (w3...w6) - just their sum will be constrained. minbleic.setlc supports both equality and inequality constraints. And there is no problem in passing mix of equality/inequality constraints to minbleic.setlc Thus your constraints can be formulated as follows:

C1) boundary one
C2) boundary one
C3) two linear inequality ones
C4) boundary one
C5) two linear inequality ones
C6) boundary one
C7) linear equality one
C8) All weights must be positive
C9) linear inequality one
C10) linear inequality one

Author:  crotundo [ Fri May 20, 2011 8:17 am ]
Post subject:  Re: Optimizations: Are aggregated bound constraints possible

Actually, splitting the thing is not the problem. That's well understood.

My question addresses the syntax of partial constraint vectors.
Up to now, I have always used constraints specifications where all weights had their own limitations, there were no "holes".

Let's assume I have one constraint, which only considers the sum of the weights e.g. w1, w2 and w6 between 2 and 15%.

I can split it in two constraints like you said.

But still:
How does the actual code like for this particular example?
What values do I have to set for those weights that are not part of the constraint? Just a comma like in VBA?
Assuming that only the position in the vector matters to define which weight should be constrained. Must I define a placeholder for w3, w4 and w5 in the definition in this particular example?

Author:  Sergey.Bochkanov [ Fri May 20, 2011 8:35 am ]
Post subject:  Re: Optimizations: Are aggregated bound constraints possible

You should just set corresponding entries of the constraints matrix to zeros. Pair of constraints above will have zeros in the first two and last four columns. See http://www.alglib.net/translator/man/ma ... nbleic_d_2 for example - zero in the "[1,0,2]" denotes variable which is not present in the sum.

Author:  Sergey.Bochkanov [ Fri May 20, 2011 8:37 am ]
Post subject:  Re: Optimizations: Are aggregated bound constraints possible

In particular, your matrix of constraints will look like:

0 0 1 1 1 1 0 0 0 0 0.08
0 0 1 1 1 1 0 0 0 0 0.21
0 0 0 0 0 0 0 0 1 1 0.07
0 0 0 0 0 0 0 0 1 1 0.21
1 1 1 1 1 1 1 1 1 1 1.00
0 1 1 1 1 0 1 0 0 0 0.45
0 0 0 0 0 1 1 1 1 0 0.58

Author:  crotundo [ Fri May 20, 2011 9:10 am ]
Post subject:  Re: Optimizations: Are aggregated bound constraints possible

Got it!

Thank you!!

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/