Thank you for your nice answer!!
Setting conditions for optimization variables
조회 수: 5 (최근 30일)
이전 댓글 표시
We are now setting the conditions for the following optimization variables.
x = optimvar('x', 100, 'LowerBound', 0)
showbounds(x)
Then,
0<=x(1)
0<=x(2)
・・・
0<=x(100).
How do we write the code to add the following condition?
We want to add an upperbond=0 in the interval 1 < x < 10.
0<=x(1)<=0
0<=x(2)<=0
・・・
0<=x(10)<=0
0<=x(11)
0<=x(12)
・・・
0<=x(100)
채택된 답변
Alan Weiss
2022년 8월 19일
x = optimvar('x', 100, 'LowerBound', 0);
ub = Inf(100,1);
ub(1:10) = zeros(10,1);
x.UpperBound = ub;
showbounds(x)
It would probably be better to remove x(1) through x(10) from your problem, but suit yourself.
Alan Weiss
MATLAB mathematical toolbox documentation
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!