issorted alternative for optimization toolbox
이전 댓글 표시
I have an optimvar A that needs to be constrained to be in descending order. The code
sorted = issorted(A,'descend') == 1;
prob.Constraints.sorted = sorted;
returns "Error using issorted. Undefined function 'issorted' for input arguments of type 'optim.problemdef.OptimizationVariable'."
Is there an alternative to 'issorted' to implement this constraint?
Thanks
채택된 답변
추가 답변 (1개)
John D'Errico
2019년 2월 20일
0 개 추천
Apparently not. However, you don't need it either. What stops you from just using a cumulative sum? Then constrain all elements of the vector but the first to be negative? The net result is you will have a decreasing sequence.
댓글 수: 1
Kendall Knight
2019년 2월 20일
편집: Kendall Knight
2019년 2월 20일
카테고리
도움말 센터 및 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!