| 906 | } |
| 907 | |
| 908 | void TPPLPartition::UpdateState(long a, long b, long w, long i, long j, DPState2** dpstates) { |
| 909 | Diagonal newdiagonal; |
| 910 | DiagonalList* pairs = NULL; |
| 911 | long w2; |
| 912 | |
| 913 | w2 = dpstates[a][b].weight; |
| 914 | if (w > w2) { |
| 915 | return; |
| 916 | } |
| 917 | |
| 918 | pairs = &(dpstates[a][b].pairs); |
| 919 | newdiagonal.index1 = i; |
| 920 | newdiagonal.index2 = j; |
| 921 | |
| 922 | if (w < w2) { |
| 923 | pairs->clear(); |
| 924 | pairs->push_front(newdiagonal); |
| 925 | dpstates[a][b].weight = w; |
| 926 | } else { |
| 927 | if ((!pairs->empty()) && (i <= pairs->begin()->index1)) { |
| 928 | return; |
| 929 | } |
| 930 | while ((!pairs->empty()) && (pairs->begin()->index2 >= j)) { |
| 931 | pairs->pop_front(); |
| 932 | } |
| 933 | pairs->push_front(newdiagonal); |
| 934 | } |
| 935 | } |
| 936 | |
| 937 | void TPPLPartition::TypeA(long i, long j, long k, PartitionVertex* vertices, DPState2** dpstates) { |
| 938 | DiagonalList* pairs = NULL; |