how to solve the chance constraint using SAA(SampleAverageApproximation)?

189 views
Skip to first unread message

katherine xue

unread,
May 15, 2013, 3:23:29 AM5/15/13
to yal...@googlegroups.com
the chance cnstraint is like : Pro(x>0)>0.8 .using SAA method to solve it.
build a indicator function : I(x)=1 if x>0 or I(x)=0 if x<=0.
here is part of my code:
 
pm=[300 200 180 100];
v=binvar(4,1)
ff=@(a,b)@(xx)(a<xx);
gg=ff(0,inf);
N=1000;
e=random('normal',0,36,1,N);
xx=ones(1,N)*(sum(v(:).*pm(:))-450)+e;
cc=sum((gg(xx)))/N;
constraints=[cc>0.8];
 
the result is:
Undefined function or method 'sum' for input arguments of type 'constraint'.
Error in ==>
cc=sum((gg(xx)))/N;
 
i have the indicator function tested using ordinary data.it works well.
so does it mean the indicator handle can not have binvar in it ?
if so , how to solve this problem?
i am a bit lost in solve the chance constraint problem, can you help me?
thanks a lot!
 
  

Johan Löfberg

unread,
May 15, 2013, 3:53:35 AM5/15/13
to yal...@googlegroups.com
First, isn't this a simple model where you can use the Gaussian cdf to simple derive a SOCP constraint

Anyway, if you want to model this in this brute-force way, you have to derive the mixed-integer model manually. If I understand your model correctly, you want at least 80% of the constraints xx>=0 to be satisfied? Hence, you have derive a big-M model

d=binvar(1,N)
[xx>=(1-d)*M, sum(d) >= 0.8*N]

M is a small-but-sufficiently-large big-M constant (i.e., a global *lower* bound on x)
http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Tutorials.Big-MAndConvexHulls

katherine xue

unread,
May 16, 2013, 10:17:44 AM5/16/13
to yal...@googlegroups.com
thank you. i've read the link page you introduced and now understand the big-m method .
you said i cannot use the gaussian cdf to derive a SOCP constraint.
would you take some trouble explaining it? i thought that is the SAA method to solve a chance consttraint optimization. because the uncertain factor of the probability constraint is the error in xx.
i have no foundation of optimization theory and now trying to use yalmip+cplex while doing my reseach, learning by working.hope to get understanding.
 
and one more question, may i ask?
i run my code many times. sometime it can give a result and sometimes not. i think it maybe because of monte carlo sampling.
how do i know where maybe be wrong with the code from the reslut matlab gives me or any other means?
like thi result:
Tried aggregator 1 time.
MIQP Presolve eliminated 161 rows and 5 columns.
MIQP Presolve modified 15 coefficients.
Reduced MIQP has 235 rows, 159 columns, and 805 nonzeros.
Reduced MIQP has 32 binaries, 0 generals, 0 SOSs, and 0 indicators.
Reduced MIQP objective Q matrix has 32 nonzeros.
Presolve time =    0.02 sec.
Probing time =    0.00 sec.
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 4 threads.
Hmm, something went wrong! 
 
thanks for your attention and patience!

Johan Löfberg

unread,
May 16, 2013, 11:04:24 AM5/16/13
to yal...@googlegroups.com
I did not say you cannot use standard SOCP approach. I asked why you don't use a standard SOCP approach.

Regarding your second question, I don't understand what you are asking. If the problem is infeasible, well, then it is infeasible. If you want to find out why it is infeasible, you have to play around with the model. Typically removing constraints until it is feasible.

katherine xue

unread,
May 16, 2013, 9:37:01 PM5/16/13
to yal...@googlegroups.com
oh, i misunderstood you.
 i wanted to compare the results of SAA and the analytical cdf method. because sometime you cannot figure out the cdf of a variable. 
my second question is that i want to know if there are any means like  debugging in matlab that can help me to find out the wrong point and why it is wrong.
yes i can try removing constraints one by one to find it out, but how does it cause the problem and why?
i think that's the helpful message. :)

Johan Löfberg

unread,
May 17, 2013, 1:39:57 AM5/17/13
to yal...@googlegroups.com
The only way to debug the optimization problem is to stop when an infeasible problem is encountered (i.e., the problem flag is 1) and start playing around with that particular instance. When I try to find the culprit I typically remove constraints until it is feasible etc, or add slacks on all constraints and add this to the objective, to see if the resulting slacks reveals something. You cannot debug the problem inside cplex is that is what you meant, as it is a binary file.

katherine X

unread,
May 19, 2013, 9:56:33 AM5/19/13
to yal...@googlegroups.com
oh i see.
thanks again!
 
Reply all
Reply to author
Forward
0 new messages