Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

setting up a quadprog constraint problem

조회 수: 3 (최근 30일)
hdg D
hdg D 2013년 10월 27일
마감: Matt J 2013년 10월 28일
Hello Below is a simple problem, I have a set of weights and I want to minimize SSD based on the following constraints
0≤A11+A12 + A21+ A22 + A31+A32 ≤0.3
0≤B1≤0.8
A11+A12 =A21+A22 =A31+A32
A11+A12 + A21+ A22 + A31+A32 + B1=1
I want to minimize sum of squared difference to the original weight vector subject to the above constraints
how do I specify this in quadprog in MATLAB the constraints?
weights.data = [0.05 0.05 0.15 0.05 0.22 0.08 0.4]
weights.header = {'A11', 'A12', 'A21', 'A22', 'A31', 'A32', 'B1'}
w0 = weights.data
Constraints = [
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
0 1 1
]
ub = [0.3 0.8 1]
lb = [0 0 1]
A0 = Constraints;
%%Inequality constraints A_le = [-A0, A0]';
b_le = [-lb, ub];
n = 7
[solution, fval, exitflag,output] = quadProg(eye(n), -w0', A_le,b_le,[],[],[],[],w0, options);
Thanks for your help!
  댓글 수: 1
Matt J
Matt J 2013년 10월 28일
편집: Matt J 2013년 10월 28일
Kindly use the
toolbar button so that your code is distinguishable from your text.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by