heuristic problem using toeplitz
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!