heuristic problem using toeplitz
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
I want to solve a heuristic problem with a toeplitz matrix. It looks like the different options can be derived from the toeplits matrix. What I want to do is subtracting a delta from one of my values in a row and adding that delta to another value in the same row. Doing calculations with all the rows will give one favorite row. That specific row will be the starting point of a new toepliz matrix to repeat that action again.
While doing this in a loop in MATLAB, you come to the point that one or more values will become <= 0. I want to hold those values at 0 while continuing the search for an optimum solution.
Is it possible in MATLAB to let values be only >= 0 in a toeplitz matrix?
The current code in MATLAB is now:
d = 0.01; %delta
n = 10; %length of vector
t = [2 2 2 2 2 2 2 2 2 2]; %startingpoint of the search (and can be any other combination of positive values)
m_1 = toeplitz([zeros(1,n-1)],[0,-d,zeros(1,n-2)]);
m_1(:,1) = d;
m_1 = m_1 + t;
What I see at this moment that in my loop column 6 will be emptied, and the values are adding to column 1. When column 6 is empty, the toeplitz matrix becomes negative. I want to switch to another column to subtract a delta from there even if that is a less profitable solution compared to going negative in column 6 (or any other column)
I hope someone can help me out, because the solution with this matrix looks better for me than the option of a nested for loop.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!