/[ascend]/trunk/solvers/ipopt/asc_ipopt.c
ViewVC logotype

Diff of /trunk/solvers/ipopt/asc_ipopt.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2339 by jpye, Wed Dec 22 12:52:47 2010 UTC revision 2340 by jpye, Sun Dec 26 11:40:15 2010 UTC
# Line 751  Bool ipopt_eval_jac_g(Index n, Number* x Line 751  Bool ipopt_eval_jac_g(Index n, Number* x
751      //CONSOLE_DEBUG("ipopt_eval_jac_g... n = %d",sys->n);      //CONSOLE_DEBUG("ipopt_eval_jac_g... n = %d",sys->n);
752      //CONSOLE_DEBUG("ipopt_eval_jac_g... m = %d",sys->m);      //CONSOLE_DEBUG("ipopt_eval_jac_g... m = %d",sys->m);
753            
     /*if(!values){  
         //CONSOLE_DEBUG("sparsity structure requested, but not implemented");  
         return 0; // failure  
     }*/  
   
754      asc_assert(sys!=NULL);      asc_assert(sys!=NULL);
755      asc_assert(n==sys->n);      asc_assert(n==sys->n);
756      asc_assert(nele_jac==sys->nnzJ);      asc_assert(nele_jac==sys->nnzJ);
# Line 767  Bool ipopt_eval_jac_g(Index n, Number* x Line 762  Bool ipopt_eval_jac_g(Index n, Number* x
762      }      }
763    
764      if(values == NULL){      if(values == NULL){
765            CONSOLE_DEBUG("sparsity structure requested");
766          k=0;          k=0;
767          for(i=0; i<m;++i){          for(i=0; i<m;++i){
768              incidence_list = (struct var_variable**) rel_incidence_list(sys->rlist[i]);              incidence_list = (struct var_variable**) rel_incidence_list(sys->rlist[i]);
769              if(incidence_list!=NULL){              if(incidence_list!=NULL){
770                  len=rel_n_incidences(sys->rlist[i]);                  len=rel_n_incidences(sys->rlist[i]);
771                  for(j=0;j<len;j++){                  for(j=0;j<len;j++){
772                            CONSOLE_DEBUG("Location of Non Zero: {%d,%d}; k = %d",i,incidence_list[j]->sindex,k);
773                            /* valgrind says invalid write of size 4 here... */
774                          iRow[k]=i; // should i use sindex of row here or is this ok?                          iRow[k]=i; // should i use sindex of row here or is this ok?
775    
776                          jCol[k++]=incidence_list[j]->sindex;                          jCol[k++]=incidence_list[j]->sindex;
                         //CONSOLE_DEBUG("Location of Non Zero: {%d,%d}; k = %d",i,incidence_list[j]->sindex,k);  
777                  }                        }      
778              }              }
779              else{              else{
# Line 783  Bool ipopt_eval_jac_g(Index n, Number* x Line 781  Bool ipopt_eval_jac_g(Index n, Number* x
781                  return FALSE; //I'm not sure about the action to take.                  return FALSE; //I'm not sure about the action to take.
782              }              }
783          }          }
784          //CONSOLE_DEBUG("Finished Locating Non-Zero elements in Sparse Matrix");          CONSOLE_DEBUG("Finished Locating Non-Zero elements in Sparse Matrix");
785      }        }else{
     else{  
786          /** @todo Allocating and Deallocating memory for each row??? you must be out of your mind :O */          /** @todo Allocating and Deallocating memory for each row??? you must be out of your mind :O */
787          k=0;          k=0;
788          variables = ASC_NEW_ARRAY(int,n);          variables = ASC_NEW_ARRAY(int,n);
# Line 1039  static int ipopt_presolve(slv_system_t s Line 1036  static int ipopt_presolve(slv_system_t s
1036      /* calculate number of non-zeros in the Jacobian matrix for the constraint equations */      /* calculate number of non-zeros in the Jacobian matrix for the constraint equations */
1037    
1038      /* @todo make sure objective rel moved to end */      /* @todo make sure objective rel moved to end */
1039    
1040        CONSOLE_DEBUG("About to call relman_jacobian_count");
1041      sys->nnzJ = relman_jacobian_count(sys->rlist, sys->m, &(sys->vfilt), &(sys->rfilt), &max);      sys->nnzJ = relman_jacobian_count(sys->rlist, sys->m, &(sys->vfilt), &(sys->rfilt), &max);
1042      /*sys->nnzJ=0;      /*sys->nnzJ=0;
1043      for(i=0;i<sys->m;++i){      for(i=0;i<sys->m;++i){
1044          sys->nnzJ += rel_n_incidences(sys->rlist[i]);          sys->nnzJ += rel_n_incidences(sys->rlist[i]);
1045      }*/      }*/
1046    
1047      //CONSOLE_DEBUG("got %d non-zeros in constraint Jacobian", sys->nnzJ);      CONSOLE_DEBUG("got %d non-zeros in constraint Jacobian", sys->nnzJ);
1048            
1049      /* need to provide sparsity structure for jacobian? */      /* need to provide sparsity structure for jacobian? */
1050    
# Line 1172  static int ipopt_solve(slv_system_t serv Line 1171  static int ipopt_solve(slv_system_t serv
1171    
1172      double *x, *x_L, *x_U, *g_L, *g_U, *mult_x_L, *mult_x_U;      double *x, *x_L, *x_U, *g_L, *g_U, *mult_x_L, *mult_x_U;
1173    
1174      //CONSOLE_DEBUG("SOLVING: sys->n = %d, sys->m = %d...",sys->n,sys->m);      CONSOLE_DEBUG("SOLVING: sys->n = %d, sys->m = %d...",sys->n,sys->m);
1175      asc_assert(sys->n!=-1);      asc_assert(sys->n!=-1);
1176    
1177      /* set the number of variables and allocate space for the bounds */      /* set the number of variables and allocate space for the bounds */

Legend:
Removed from v.2339  
changed lines
  Added in v.2340

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22