?? change_order.c
字號:
/* DATE : 1/17/92 *//* *//* *//* REV DATE BY DESCRIPTION *//* --- ---- -- ----------- *//* *//* *//********************************************************************************/void find_new_in_eq(a1b, a1a2, ll, ul, rc, newin) VECTOR a1b, /* the product of a-inverse and b */ ll, ul; /* upper and lower limits of the * domain constraints */ MATRIX a1a2, /* the products of a-inverse and * matrix a2 */ newin; /* the final matrix with domain * constraints */ INDEX rc;{ int i, j; for (i = 1; i <= rc.r; i++) for (j = 1; j <= rc.c; j++) if (j == 1) newin[i][j] = ll[i] - a1b[i]; /* eliminating the constrants * from the */ else if (j == rc.c) /* equations in the domain * constraints */ newin[i][j] = ul[i] - a1b[i]; else newin[i][j] = 0 - a1a2[i][j - 1];}/********************************************************************************//* *//* FUNCTION NAME : find_org_in_eq() *//* *//* SYNOPSIS : void find_org_in_eq(a1_b,a1_a2,vec_d,c1,c2, *//* c1row,a1a2,org_ineq)*//* *//* DESCRIPTION : This function converts the original *//* inequality constraints into domain *//* constraints, with the variables other than *//* the p-variables eliminated *//* *//* FUNCTIONS CALLED : matrix(). *//* mmprod(), *//* mvprod(), *//* vector(), *//* *//* CALLING FUNCITONS : main() *//* *//* AUTHOR : Swarnalatha Swaminathan *//* *//* DATE : 1/17/92 *//* *//* *//* REV DATE BY DESCRIPTION *//* --- ---- -- ----------- *//* *//* *//********************************************************************************/void find_org_in_eq(a1_b, a1_a2, vec_d, c1, c2, c1row, a1a2, org_ineq) VECTOR vec_d, /* the RHS constant vector */ a1_b; /* product of a1-inverse and b */ MATRIX a1_a2, /* product of a1-inverse and a2 */ org_ineq, /* the converted inequalities * into domains */ c1, c2; /* p_inequalities and the * remaining inequalities */ int c1row; INDEX a1a2; /* rows and columns of the * matrices */{ int i, j; VECTOR temp; MATRIX mat; temp = vector(1, c1row); mat = matrix(1, c1row, 1, a1a2.c - 1); mvprod(c1row, a1a2.r, temp, c1, a1_b); /* matrix, vector product * C1.invA1.b */ mmprod(c1row, a1a2.r, a1a2.c - 1, mat, c1, a1_a2); /* matrix, matrix * product */ for (i = 1; i <= c1row; i++) for (j = 1; j <= a1a2.c; j++) { if (j == a1a2.c) org_ineq[i][j] = vec_d[i] - temp[i]; else org_ineq[i][j] = c2[i][j] - mat[i][j]; } free_vector(temp, 1); free_matrix(mat, 1, c1row, 1);}/********************************************************************************//* *//* FUNCTION NAME : initialize() *//* *//* SYNOPSIS : void initialize(mat,rc) *//* *//* DESCRIPTION : This function initializes all the components *//* of the given matrix to zero *//* *//* FUNCTIONS CALLED : None *//* *//* CALLING FUNCITONS : main() *//* *//* AUTHOR : Swarnalatha Swaminathan *//* *//* DATE : 1/17/92 *//* *//* *//* REV DATE BY DESCRIPTION *//* --- ---- -- ----------- *//* *//* *//********************************************************************************/void initialize(mat, rc) MATRIX mat; INDEX rc;{ int i, j; for (i = 1; i <= rc.r; i++) for (j = 1; j <= rc.c; j++) mat[i][j] = 0.0;}/********************************************************************************//* *//* FUNCTION NAME : find_final_mat1() *//* *//* SYNOPSIS : void find_final_mat1(x2,l2,u2,finmat,row,col)*//* *//* DESCRIPTION : This function copies the remaining original *//* domain constraints on to the final matrix *//* to be output *//* *//* FUNCTIONS CALLED : None *//* *//* CALLING FUNCITONS : main() *//* *//* AUTHOR : Swarnalatha Swaminathan *//* *//* DATE : 1/17/92 *//* *//* *//* REV DATE BY DESCRIPTION *//* --- ---- -- ----------- *//* *//* *//********************************************************************************/void find_final_mat1(l2, u2, finmat, row, col) MATRIX finmat; VECTOR l2, u2; int row, col;{ int i, j = 2; for (i = 1; i <= row; i++) { finmat[i][1] = l2[i]; finmat[i][col] = u2[i]; finmat[i][j++] = 1.0; }}/********************************************************************************//* *//* FUNCTION NAME : find_final_mat2() *//* *//* SYNOPSIS : void find_final_mat2(newin,r,c,finr,finmat) *//* *//* DESCRIPTION : This function appends the new inequalities *//* got from the original equalities, on to the *//* final matrix to be output *//* *//* FUNCTIONS CALLED : None *//* *//* CALLING FUNCITONS : main() *//* *//* AUTHOR : Swarnalatha Swaminathan *//* *//* DATE : 1/17/92 *//* *//* *//* REV DATE BY DESCRIPTION *//* --- ---- -- ----------- *//* *//* *//********************************************************************************/void find_final_mat2(newin, r, c, finr, finmat) MATRIX newin, finmat; int r, c, finr;{ int i, j; for (i = 1; i <= r; i++) { for (j = 1; j <= c; j++) finmat[finr][j] = newin[i][j]; finr++; }}/********************************************************************************//* *//* FUNCTION NAME : find_final_mat3() *//* *//* SYNOPSIS : void find_final_mat3(orgin,r,c,finr,finmat) *//* *//* DESCRIPTION : This function appends the inequalities, which*//* were converted into domain constraints, on *//* to the final matrix to be output *//* *//* FUNCTIONS CALLED : None *//* *//* CALLING FUNCITONS : main() *//* *//* AUTHOR : Swarnalatha Swaminathan *//* *//* DATE : 1/17/92 *//* *//* *//* REV DATE BY DESCRIPTION *//* --- ---- -- ----------- *//* *//* *//********************************************************************************/void find_final_mat3(orgin, r, c, finr, finmat) MATRIX orgin, finmat; int r, c, finr;{ int i, j; for (i = 1; i <= r; i++) { finmat[finr][1] = MIN; for (j = 1; j <= c; j++) finmat[finr][j + 1] = orgin[i][j]; finr++; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -