issorted alternative for optimization toolbox
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kendall Knight
am 20 Feb. 2019
Bearbeitet: Matt J
am 20 Feb. 2019
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
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
John D'Errico
am 20 Feb. 2019
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 Kommentar
Siehe auch
Kategorien
Mehr zu Problem-Based Optimization Setup finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!