User:Karthik0112358: Difference between revisions

From ASCEND
Jump to navigation Jump to search
Line 5: Line 5:


== Progress reports ==
== Progress reports ==
'''Prior to 23 May 2011:'''
'''June 17'''
After giving it some thought, I think the structure of the mass matrix function should look more like system_jacobian() which is present in [http://www.ascend4.org/doxy/d1/d56/a00707_source.html#l00028 jacobian.c] in ascend/system. Will sketch a pseudo code out.


Related to rSQP:
'''June 16'''
* Started reading [http://trilinos.sandia.gov/packages/docs/r10.6/packages/moocho/doc/html/MoochoOverview.pdf Mathematical and High-Level Overview of MOOCHO]. However was later redirected to chapter 12 (Nonlinear programming) of "Operations Research: Applications and Algorithms" from Winston, 1994, 3rd (or a later) Ed., Duxbury Press (Belmont, California) as a preliminary reading for mathematical background.
* Reading relman_diff2() and trying to understand what are the input variables, which header to include, etc. Got some nice help from http://www.ascend4.org/doxy/d0/d7e/a00770.html#ga9469a6f8ff5a7d0eec8a1cad74732fdf. Came with some pseudo code
* Completed reading chapter 12 (Nonlinear programming) of "Operations Research: Applications and Algorithms".  
<source lang="c">
* Re-reading [http://trilinos.sandia.gov/packages/docs/r10.6/packages/moocho/doc/html/MoochoOverview.pdf Mathematical and High-Level Overview of MOOCHO].
#include <ascend/compiler/rel_blackbox.h>
* Revisited theory behind the Simplex Algorithm from "Introduction to Algorithms", 3rd Edition, Page 864-879 authored by Cormen, Leisersin, Rivest, Stein.
//#include <ascend/compiler/relation.h>
//#include <ascend/compiler/relation_util.h>
//#include <ascend/compiler/relation_io.h>
//#include "mass_matrix.h"
//#include "slv_server.h"
#define IPTR(i) ((struct Instance *)(i))
#define KILL 0 /* compile dead code if kill = 1 */
#define REIMPLEMENT 0 /* code that needs to be reimplemented */
#define rel_tmpalloc_array(nelts,type) \
  ((nelts) > 0 ? (type *)tmpalloc((nelts)*sizeof(type)) : NULL)
static double dsolve_scratch = 0.0;        /* some workspace */
#define DSOLVE_TOLERANCE 1.0e-08                /* no longer needed */
#define BROKENKIRK 0
/* return 0 on success (derivatives, variables and count are output vars too) */
int massmatrix(struct rel_relation *rel, const var_filter_t *filter
        ,real64 *derivatives, int32 *variables
        ,int32 *count){
  const struct var_variable **vlist=NULL;
  int32 len,c;
  int status;
  //CONSOLE_DEBUG("In Function: relman_diff2");
  assert(rel!=NULL && filter!=NULL);
  len = rel_n_incidences(rel);//this gives me the length of incidence- which I think is the number of columns of mass matrix
  vlist = rel_incidence_list(rel);//have to write rel_mass_matrix() which basically does the same thing
  *count = 0;


Related to Radau5:
    for (c=0; c < len; c++) {
* Investigated code ascend/integrator/integrator.h and ascend/integrator/integrator.c to understand the data structures used.
    //write the stuff here
* Devised and tried implementation of various for the mass matrix problem in solvers/radau5/asc_radau5.c.
   
* Settled on the idea of replacing neq with total number of equations as compared to the previous implementation of number of states.
      }


'''May 23 - May 29'''
    return status;
* Continue reading [http://trilinos.sandia.gov/packages/docs/r10.6/packages/moocho/doc/html/MoochoOverview.pdf Mathematical and High-Level Overview of MOOCHO].


'''May 30 - June 5'''
}
* Completed reading [http://trilinos.sandia.gov/packages/docs/r10.6/packages/moocho/doc/html/MoochoOverview.pdf Mathematical and High-Level Overview of MOOCHO].
</source>
 
'''June 6 - June 12'''
Finding a temporary fix for the mass matrix problem. I have split the task as to finding solution to 2 problems:
* (i) Making sure algebraic equations are being sent to solver.
* (ii) Writing a feasible mass matrix function to generate the mass matrix. This depends on (i).
 
Regarding Solving Part (i), I made an outside link and was able to capture all the variables involved. Trying to use them to find total number of equations. In completing part (ii) I am facing "INSUFFICIENT MEMORY" problem. Trying to fix that too. I am at present able to count total number of variables, solver variables, independent variables and number of differential equations. I would like to figure out a way to count number of free variables.
 
I have been able to find a solution to part(i), but it has 2 constraints,
* If number of total variables>>total number of equations, then the max number of substeps has to be reduced.
* The solution involves providing data outside given data structures and thus cannot employed as it is to ascend.
 
As far as part (ii) goes, there seems to be a simple fix. I am trying to figure it out through Valgrind's Memory loss method.
 
'''June 13 - June 19'''
* Use of [[valgrind]] did not provide much insight. ''Karthik: add DETAILS of what you found here please -- [[User:Jpye|Jpye]] 07:53, 16 June 2011 (UTC)''


'''June 15'''
'''June 15'''
Line 72: Line 80:
I contacted Bartlett, Roscoe A (rabartl@sandia.gov) via email regarding this problem. Hoping for an early reply.
I contacted Bartlett, Roscoe A (rabartl@sandia.gov) via email regarding this problem. Hoping for an early reply.


'''June 16'''
'''June 13 - June 19'''
* Reading relman_diff2() and trying to understand what are the input variables, which header to include, etc. Got some nice help from http://www.ascend4.org/doxy/d0/d7e/a00770.html#ga9469a6f8ff5a7d0eec8a1cad74732fdf.  
* Use of [[valgrind]] did not provide much insight. ''Karthik: add DETAILS of what you found here please -- [[User:Jpye|Jpye]] 07:53, 16 June 2011 (UTC)''
 
'''June 6 - June 12'''
Finding a temporary fix for the mass matrix problem. I have split the task as to finding solution to 2 problems:
* (i) Making sure algebraic equations are being sent to solver.
* (ii) Writing a feasible mass matrix function to generate the mass matrix. This depends on (i).
 
Regarding Solving Part (i), I made an outside link and was able to capture all the variables involved. Trying to use them to find total number of equations. In completing part (ii) I am facing "INSUFFICIENT MEMORY" problem. Trying to fix that too. I am at present able to count total number of variables, solver variables, independent variables and number of differential equations. I would like to figure out a way to count number of free variables.
 
I have been able to find a solution to part(i), but it has 2 constraints,
* If number of total variables>>total number of equations, then the max number of substeps has to be reduced.
* The solution involves providing data outside given data structures and thus cannot employed as it is to ascend.
 
As far as part (ii) goes, there seems to be a simple fix. I am trying to figure it out through Valgrind's Memory loss method.
 
'''May 30 - June 5'''
* Completed reading [http://trilinos.sandia.gov/packages/docs/r10.6/packages/moocho/doc/html/MoochoOverview.pdf Mathematical and High-Level Overview of MOOCHO].
 
'''May 23 - May 29'''
* Continue reading [http://trilinos.sandia.gov/packages/docs/r10.6/packages/moocho/doc/html/MoochoOverview.pdf Mathematical and High-Level Overview of MOOCHO].
 
'''Prior to 23 May 2011:'''
 
Related to rSQP:
* Started reading [http://trilinos.sandia.gov/packages/docs/r10.6/packages/moocho/doc/html/MoochoOverview.pdf Mathematical and High-Level Overview of MOOCHO]. However was later redirected to chapter 12 (Nonlinear programming) of "Operations Research: Applications and Algorithms" from Winston, 1994, 3rd (or a later) Ed., Duxbury Press (Belmont, California) as a preliminary reading for mathematical background.
* Completed reading chapter 12 (Nonlinear programming) of "Operations Research: Applications and Algorithms".
* Re-reading [http://trilinos.sandia.gov/packages/docs/r10.6/packages/moocho/doc/html/MoochoOverview.pdf Mathematical and High-Level Overview of MOOCHO].
* Revisited theory behind the Simplex Algorithm from "Introduction to Algorithms", 3rd Edition, Page 864-879 authored by Cormen, Leisersin, Rivest, Stein.  
 
Related to Radau5:
* Investigated code ascend/integrator/integrator.h and ascend/integrator/integrator.c to understand the data structures used.
* Devised and tried implementation of various for the mass matrix problem in solvers/radau5/asc_radau5.c.
* Settled on the idea of replacing neq with total number of equations as compared to the previous implementation of number of states.  
[[Category:GSOC2011]]
[[Category:GSOC2011]]

Revision as of 18:14, 17 June 2011

C S Karthik is an undergraduate at IIT-Bombay and is working on addition of an rSQP optimiser for ASCEND during GSOC2011.

Goals

The reduced space SQP (rSQP) algorithm has seen many applications in large-scale engineering models. I intend to accept an input and parse it such that the solver can act on it. Further I am going to take up various test cases and check for bugs/inconsistencies. And if time permits I would like to write an optimization algorithm/code which, based on the given input, decides which is the best solver to send the input to.

Progress reports

June 17 After giving it some thought, I think the structure of the mass matrix function should look more like system_jacobian() which is present in jacobian.c in ascend/system. Will sketch a pseudo code out.

June 16

#include <ascend/compiler/rel_blackbox.h>
//#include <ascend/compiler/relation.h>
//#include <ascend/compiler/relation_util.h>
//#include <ascend/compiler/relation_io.h>
//#include "mass_matrix.h"
//#include "slv_server.h"
#define IPTR(i) ((struct Instance *)(i))
#define KILL 0 /* compile dead code if kill = 1 */
#define REIMPLEMENT 0 /* code that needs to be reimplemented */
#define rel_tmpalloc_array(nelts,type)  \
   ((nelts) > 0 ? (type *)tmpalloc((nelts)*sizeof(type)) : NULL)
static double dsolve_scratch = 0.0;        /* some workspace */
#define DSOLVE_TOLERANCE 1.0e-08                /* no longer needed */
#define BROKENKIRK 0
/* return 0 on success (derivatives, variables and count are output vars too) */
int massmatrix(struct rel_relation *rel, const var_filter_t *filter
        ,real64 *derivatives, int32 *variables
        ,int32 *count){
  const struct var_variable **vlist=NULL;
  int32 len,c;
  int status;
  //CONSOLE_DEBUG("In Function: relman_diff2");
  assert(rel!=NULL && filter!=NULL);
  len = rel_n_incidences(rel);//this gives me the length of incidence- which I think is the number of columns of mass matrix
  vlist = rel_incidence_list(rel);//have to write rel_mass_matrix() which basically does the same thing
  *count = 0;

    for (c=0; c < len; c++) {
     //write the stuff here
     
      }

    return status;

}

June 15

  • Trying to understand about expression-evaluation data structures by reading the following c code: ascend/system/relman.c.
  • Re-reading Developer's Manual for better clarity.
  • Checked out contents of Moocho and broadly read basic documentation.
  • Installing MOOCHO: Downloaded trilinos-10.6.4-Source.tar.gz. As first step of the installation, I downloaded CMake. In the last step of Installation of CMake, I got the following error:

CMake Error at cmake_install.cmake:36 (FILE): file cannot create directory: /usr/local/doc/cmake-2.8. Maybe need administrative privileges.

make: *** [install] Error 1

Further on trying to install Trilinos, with the following commands, I got the following error :

~/SOME_BUILD_DIR$ cmake \

> -D CMAKE_BUILD_TYPE:STRING=DEBUG \

> -D Trilinos ENABLE <moocho>:BOOL=ON \

> -D Trilinos_ENABLE_TESTS:BOOL=ON \

> -D DART_TESTING_TIMEOUT:STRING=600 \

> $EXTRA_ARGS \

> {TRILINOS_HOME}

bash: moocho: No such file or directory

I contacted Bartlett, Roscoe A (rabartl@sandia.gov) via email regarding this problem. Hoping for an early reply.

June 13 - June 19

  • Use of valgrind did not provide much insight. Karthik: add DETAILS of what you found here please -- Jpye 07:53, 16 June 2011 (UTC)

June 6 - June 12 Finding a temporary fix for the mass matrix problem. I have split the task as to finding solution to 2 problems:

  • (i) Making sure algebraic equations are being sent to solver.
  • (ii) Writing a feasible mass matrix function to generate the mass matrix. This depends on (i).

Regarding Solving Part (i), I made an outside link and was able to capture all the variables involved. Trying to use them to find total number of equations. In completing part (ii) I am facing "INSUFFICIENT MEMORY" problem. Trying to fix that too. I am at present able to count total number of variables, solver variables, independent variables and number of differential equations. I would like to figure out a way to count number of free variables.

I have been able to find a solution to part(i), but it has 2 constraints,

  • If number of total variables>>total number of equations, then the max number of substeps has to be reduced.
  • The solution involves providing data outside given data structures and thus cannot employed as it is to ascend.

As far as part (ii) goes, there seems to be a simple fix. I am trying to figure it out through Valgrind's Memory loss method.

May 30 - June 5

May 23 - May 29

Prior to 23 May 2011:

Related to rSQP:

  • Started reading Mathematical and High-Level Overview of MOOCHO. However was later redirected to chapter 12 (Nonlinear programming) of "Operations Research: Applications and Algorithms" from Winston, 1994, 3rd (or a later) Ed., Duxbury Press (Belmont, California) as a preliminary reading for mathematical background.
  • Completed reading chapter 12 (Nonlinear programming) of "Operations Research: Applications and Algorithms".
  • Re-reading Mathematical and High-Level Overview of MOOCHO.
  • Revisited theory behind the Simplex Algorithm from "Introduction to Algorithms", 3rd Edition, Page 864-879 authored by Cormen, Leisersin, Rivest, Stein.

Related to Radau5:

  • Investigated code ascend/integrator/integrator.h and ascend/integrator/integrator.c to understand the data structures used.
  • Devised and tried implementation of various for the mass matrix problem in solvers/radau5/asc_radau5.c.
  • Settled on the idea of replacing neq with total number of equations as compared to the previous implementation of number of states.