- Timestamp:
- Dec 24, 2012 2:19:20 PM (7 years ago)
- Location:
- trunk/Couenne/src/cut/sdpcuts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Couenne/src/cut/sdpcuts/CouenneMatrix.cpp
r931 r932 108 108 } 109 109 110 check_and_insert (rowInd, colInd, row_, elem); 111 check_and_insert (colInd, rowInd, col_, new exprClone (elem)); 110 check_and_insert (rowInd, colInd, row_, elem); 111 if (elem -> code () == COU_EXPRCONST) 112 elem = new exprClone (elem); 113 check_and_insert (colInd, rowInd, col_, elem); 112 114 } 113 115 -
trunk/Couenne/src/cut/sdpcuts/CutGen.cpp
r930 r932 624 624 int *card_v_mat, 625 625 int *evdec_num) const { 626 627 if (running_n==1) 626 if (running_n == 1) 628 627 return; 629 628 … … 634 633 635 634 double 636 637 635 best_val = 1, 638 636 … … 649 647 *z = new double [rnsq]; 650 648 651 // while (running_n > 1)649 // while (running_n > 1) 652 650 653 651 for (int k=0; k<running_n; k++) { … … 679 677 (*evdec_num)++; 680 678 679 //------------------------------------------------------------------------------------------------------------------------------ 681 680 dsyevx_interface (running_n - 1, T, card_ev, w, z, EV_TOL, -COIN_DBL_MAX, 0., 1, (running_n-1 == min_nz) ? (running_n - 1) : 1); 681 //------------------------------------------------------------------------------------------------------------------------------ 682 682 683 683 double val = w [0]; // minimum eigenvalue … … 768 768 delete [] wbest; 769 769 770 }// myremoveBestOneRowCol ()770 }// myremoveBestOneRowCol () 771 771 772 772 … … 778 778 double *matrix = new double [n*n]; 779 779 780 // matrix[0] = 1;781 // for (int i=0;i<n;i++)782 // matrix[n*(i+1)] = sol[i];783 784 780 for (int i=0; i<n; i++) 785 781 for (int j=i; j<n; j++) … … 789 785 790 786 delete [] matrix; 791 }// sparsify2() 792 787 } // sparsify2 () 788 789 790 // Adds SDP cuts using negative eigenvectors where small (smaller than 791 // COUENNE_EPS) components are fixed to zero 793 792 794 793 /************************************************************************/ … … 799 798 const double *A, 800 799 const double *vector, 801 int **indA) const{ 802 803 int *indices; 804 indices = new int [n]; 805 int cnt = 0; 806 807 for(int i=0;i<n;i++) 800 int **indA) const { 801 int 802 *indices = new int [n], 803 cnt = 0; 804 805 for (int i=0; i < n; i++) 808 806 indices [i] = ((fabs (vector [i]) > COUENNE_EPS) ? (cnt++) : -1); 809 807 810 double *subA = new double[cnt*cnt]; 811 812 for (register int i=0; i<n; i++) { 808 double *subA = new double [cnt*cnt]; 809 810 for (register int i=0, k=0; i<n; i++) 811 813 812 if (indices [i] >= 0) { 814 for (register int j=0; j<n; j++) { 813 814 for (register int j=0, k2 = 0; j<n; j++) 815 815 816 if (indices [j] >= 0) 816 subA [cnt *indices[j] + indices[i]] = A[n*j+i];817 } 818 }819 }817 subA [cnt * k + k2++] = A [n*i + j]; 818 819 ++k; 820 } 820 821 821 822 double *w = NULL, *z = NULL; … … 832 833 for (int k=0; k<m; k++) { 833 834 834 if (onlyNegEV_ && (w [k] > 0))835 if (onlyNegEV_ && (w [k] >= 0.)) 835 836 break; 836 837 … … 840 841 v [j] = *zbase++; 841 842 842 for(int j=0; j<n;j++)843 newv [j] = (indices[j] >= 0) ? v [indices[j]] : newv[j] = 0;843 for(int j=0; j<n; j++) 844 newv [j] = (indices [j] >= 0) ? v [indices [j]] : 0.; 844 845 845 846 genSDPcut (si, cs, minor, newv, newv, indA);
Note: See TracChangeset
for help on using the changeset viewer.