From: Rainer M. <ra...@tb...> - 2006-11-23 17:38:24
|
Hi Friends, here a rough todo list for the next release ... at least some of the stuff below should be done before the next release. If you have preferences/opions or want to add things feel free: Functionality: General: * odeSolverBatch (use Eryk's code) * assignment rule ordering (also consider DAE systems/IDA solver extension) * variable compartments, ODEs in amounts * online compilation * exact event detection -> Rainer and Xtof Text-based input files for: ** reaction network: Vienna Reaction library ** ODE system: xppaut format -> Xtof Sens. Analysis output: * Direct Lyapunov Exponent analysis * Fisher Information Matrix -> James and Stefan :-) ??? Dependencies: * libSBML 3 * Sundials 2.3.0 -> Rainer and Xtof Pending: * Test suite ?? ** Functionality ** Performance Configure: * malloc.h * -R/-rpath switch * general refactoring!! -> Rainer and Xtof |
From: W E. W. <wew...@gm...> - 2007-02-01 16:03:23
|
Hi Rainer , all... Add 1 Currently I went further and have introduced two "classes" CB_SimulatorInterface and CB_Solver which encapsulate the integrator instance - allow for an easy update of parameters and return a structure CB_SimulatorOutput and CB_SimulatoroutputSet ... which are part of an CaliBayes API which we are developing here in Newcastle in the programming language C. Both those classes CB_SimulatorInterface and CB_Solver depend on a patched version of the SBML ode Solver API .. it would be a huge help if this patch could be integrated into the standard development tree of the SBML ode Solver API ... The changes I would be going to make are going to include: editing src/Makefile.am adding src/varySettings.c adding src/sbmlsolver/varySettings.h editing Makefile.am <http://makefile.am/> in directory example. and adding examples/Sensitivitytest.c examples/DesignPointExample.c I kept all the functions which I would like to have added to SBML_Solver in varySettings.c and varySettings.h. However, I do patch many of the existing structures in the lib e.g. SBML_ODESOLVER_API Variable_t * OdeModel_getVariable( odeModel_t * odemodel , double value, char * parameterStr , char * reactionStr ); SBML_ODESOLVER_API Variable_t * VariableIndex_getVariable( variableIndex_t * vi, double value, char *parameterStr , char *reactionStr); SBML_ODESOLVER_API void Variable_free( Variable_t *variable ); SBML_ODESOLVER_API int IntegratorInstance_setDesignPoint(integratorInstance_t * integratorInstance, DesignPoint_t * designpoint); SBML_ODESOLVER_API Variable_t * Variable_create( double value, char *parameterStr , char *reactionStr); SBML_ODESOLVER_API int Model_change(Model_t *model, /*SBML level 2! See example*/ DesignPoint_t *dp); SBML_ODESOLVER_API cvodeResults_t * Model_solve(Model_t * model , cvodeSettings_t *settings); the only new struct I introduced is DesignPoint (ParameterSet migth be a better name). I remember adding varySettings.h and varySettings.c 2006 only to find this files deleted a few weeks later... it might be better if a few people review the code first so that a more persistent change if wished can be made. I attach the files... cheers Eryk On 11/23/06, Rainer Machne <ra...@tb...> wrote: > > Hi Friends, > > here a rough todo list for the next release ... at least some of the > stuff below should be done before the next release. If you have > preferences/opions or want to add things feel free: > > Functionality: > General: > * odeSolverBatch (use Eryk's code) > * assignment rule ordering (also consider DAE systems/IDA solver > extension) > * variable compartments, ODEs in amounts > * online compilation > * exact event detection > -> Rainer and Xtof > > Text-based input files for: > ** reaction network: Vienna Reaction library > ** ODE system: xppaut format > -> Xtof > > Sens. Analysis output: > * Direct Lyapunov Exponent analysis > * Fisher Information Matrix > -> James and Stefan :-) ??? > > Dependencies: > * libSBML 3 > * Sundials 2.3.0 > -> Rainer and Xtof > > Pending: > * Test suite ?? > ** Functionality > ** Performance > > Configure: > * malloc.h > * -R/-rpath switch > * general refactoring!! > -> Rainer and Xtof > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > sbmlsolver-devel mailing list > sbm...@li... > https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel > |
From: Rainer M. <ra...@tb...> - 2007-02-01 18:46:01
|
Hi Eryk, I took a quick look and - wow - that looks very nice! As we are currently not in an active development phase, it may take some time until we can fully review and test everything. I try my best below, and stronlgy hope that I am not misinterpreting. One first question about your structure Variable_t: In its definition, it says double value; /**< two dimensional array with the design points */ but actually is not an array but a simple double. Should it become one? Or do I understand it wrongly? If yes, we could then have a batch solver function, that loops through the designpoints and returns an array of cvodeResults or SBMLResults, right? In the following some questions, regarding possible integration and fusion of your function with existing functions. This is based on my above interpreation that double value should be an array. If this is not the case, then please just forget my alternative proposal in the following: W Eryk Wolski wrote: > The changes I would be going to make are going to include: > editing src/Makefile.am > adding src/varySettings.c > adding src/sbmlsolver/varySettings.h > > editing Makefile.am <http://makefile.am/> in directory example. > and adding > examples/Sensitivitytest.c > examples/DesignPointExample.c From my first peek it looks as if you do not need to change any existing files (except for Makefiles). Is this correct? > > I kept all the functions which I would like to have added to SBML_Solver > in varySettings.c and varySettings.h. However, I do patch many of the > existing structures in the lib e.g. > > SBML_ODESOLVER_API Variable_t * OdeModel_getVariable( odeModel_t * > odemodel , double value, char * parameterStr , char * reactionStr ); > SBML_ODESOLVER_API Variable_t * VariableIndex_getVariable( > variableIndex_t * vi, double value, char *parameterStr , char *reactionStr); > SBML_ODESOLVER_API void Variable_free( Variable_t *variable ); One problematic thing is the potential confusion of having to different structures with very similar names: Variable_t and VariableIndex_t. I would like to propose an alternative (hoping that I understood your code correctly): First, handling of local reaction/kinetic law parameters: We could introduce a function like variableIndex_t *ODEModel_getRxnVariableIndex(odeModel_t *odemodel, char *parameterStr, char *reactionStr) which would retrieve the existing variableIndex_t only if the calling application has done globalizeParameter(model, parameterStr, reactionStr) before constructing the odeModel_t (it would just return NULL if the variable called "r_rid_id" is not available). This would actually be a nice service offered by SOSlib! Internally we could add the field "rid" to variableIndex and use the fused version "r_rid_id" in the equations only. This way we would be fit to change the internal concatenation in case this becomes necessary for future SBML versions (who knows :) ). Second, to set the DesignPoint structure, we could fuse v4 = OdeModel_getVariable(odemodel,.1,"V2","J1"); DesignPoint_addDimension(dp,v4,3); into vi = ODEModel_getRxnVariableIndex(odemodel, "V2","J1"); DesignPoint_addDimension(dp, vi, 3, .1), This would include moving the "value" array (if it should be one) from Variable_t to the DesignPoint_t, replacing the Variable_t field in DesignPoint_t by the existing variableIndex_t and changing the function DesignPoint_addDimension to also take the value. Did I get something wrong? > SBML_ODESOLVER_API int > IntegratorInstance_setDesignPoint(integratorInstance_t * > integratorInstance, DesignPoint_t * designpoint); This is just a wrapper around IntegratorInstance_setVariableValue to be called after IntegratorInstance_reset, right? In case that "value" should be an array, this function would need to be passed an additional index, to indicate to which values to set the model to, right? > SBML_ODESOLVER_API Variable_t * Variable_create( double value, char > *parameterStr , char *reactionStr); > SBML_ODESOLVER_API int Model_change(Model_t *model, /*SBML level 2! See > example*/ > DesignPoint_t *dp); This is just like IntegratorInstance_setDesignPoint but on the level of the SBML structure Model_t, right? By having the additional "rid" field in VariableIndex_t above suggestions should also work on this level. > SBML_ODESOLVER_API cvodeResults_t * Model_solve(Model_t * model , > cvodeSettings_t *settings); Is this different from the existing function Model_odeSolver((Model_t *m, cvodeSettings_t *set) ? > the only new struct I introduced is DesignPoint (ParameterSet migth be a > better name). I also like DesignPoint, but I guess you are right, and ParameterSet is easier to understand. On the other hand, the same function could also be used to vary initial conditions, and thus ODE variables, right? > > I remember adding varySettings.h and varySettings.c 2006 only to find > this files deleted a few weeks later... Sorry for that. It didn't use SOSlib's internal memory and error management, which were very fresh back then. And I wanted to fuse it into the existing code, but as you might remember, I miserably failed :-( back then. And sorry if I misunderstood your code and above suggestions won't work. Currently the next release is planned for March or April and I definitely hope that we can take DesignPoint/ParameterSet and batch solver wrapper functions into this release. Thanks for the contribution! Rainer it might be better if a few > people review the code first so that a more persistent change if wished > can be made. > I attach the files... > > cheers > Eryk > > > > On 11/23/06, *Rainer Machne* <ra...@tb... > <mailto:ra...@tb...>> wrote: > > Hi Friends, > > here a rough todo list for the next release ... at least some of the > stuff below should be done before the next release. If you have > preferences/opions or want to add things feel free: > > Functionality: > General: > * odeSolverBatch (use Eryk's code) > * assignment rule ordering (also consider DAE systems/IDA solver > extension) > * variable compartments, ODEs in amounts > * online compilation > * exact event detection > -> Rainer and Xtof > > Text-based input files for: > ** reaction network: Vienna Reaction library > ** ODE system: xppaut format > -> Xtof > > Sens. Analysis output: > * Direct Lyapunov Exponent analysis > * Fisher Information Matrix > -> James and Stefan :-) ??? > > Dependencies: > * libSBML 3 > * Sundials 2.3.0 > -> Rainer and Xtof > > Pending: > * Test suite ?? > ** Functionality > ** Performance > > Configure: > * malloc.h > * -R/-rpath switch > * general refactoring!! > -> Rainer and Xtof > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> > _______________________________________________ > sbmlsolver-devel mailing list > sbm...@li... > <mailto:sbm...@li...> > https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel > > > > ------------------------------------------------------------------------ > > /* > Last changed Time-stamp: <2006-04-19 16:23:17 raim> > $Id: varySettings.c,v 1.1 2006/05/08 13:40:53 witek96 Exp $ > */ > /* > * > * This library is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as published > * by the Free Software Foundation; either version 2.1 of the License, or > * any later version. > * > * This library is distributed in the hope that it will be useful, but > * WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF > * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and > * documentation provided hereunder is on an "as is" basis, and the > * authors have no obligations to provide maintenance, support, > * updates, enhancements or modifications. In no event shall the > * authors be liable to any party for direct, indirect, special, > * incidental or consequential damages, including lost profits, arising > * out of the use of this software and its documentation, even if the > * authors have been advised of the possibility of such damage. See > * the GNU Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public License > * along with this library; if not, write to the Free Software Foundation, > * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. > * > * The original code contained here was initially developed by: > * > * Witold Wolski > * > * Contributor(s): > * > */ > > #include "sbmlsolver/varySettings.h" > > > /**Allocate storage for DesignPoint_t of dimensions*/ > > SBML_ODESOLVER_API DesignPoint_t* DesignPoint_create(int dimensions) > { > DesignPoint_t * dp; > ASSIGN_NEW_MEMORY(dp, struct DesignPoint, NULL); > dp->dimensions = dimensions; > dp->variables = (Variable_t ** ) calloc(dimensions, sizeof(Variable_t)); > return(dp); > } > > SBML_ODESOLVER_API DesignPoint_t * DesignPoint_clone(DesignPoint_t * designpoint) > { > DesignPoint_t * dp; > ASSIGN_NEW_MEMORY(dp, struct DesignPoint, NULL); > dp->dimensions = designpoint->dimensions; > dp->variables = (Variable_t ** ) calloc(designpoint->dimensions , sizeof(Variable_t)); > > return(dp); > } > > > SBML_ODESOLVER_API void DesignPoint_free(DesignPoint_t* designpoint) > { > int i; > for(i=0;i < designpoint->dimensions; i++) > { > Variable_free(designpoint->variables[i]); > } > free(designpoint->variables); > free(designpoint); > } > > SBML_ODESOLVER_API void DesignPoint_dumpXML(DesignPoint_t * dp, FILE * pFile) > { > int i; > variableIndex_t * vi; > fprintf(pFile,"<DesignPoint dimensions=\"%i\">\n",dp->dimensions); > for(i =0; i < dp->dimensions; i++) > { > if(dp->variables[i] != NULL) > { > fprintf(pFile," <variable id=\"%s\" ",dp->variables[i]->id); > fprintf(pFile," rid=\"%s\" ",dp->variables[i]->rid); > fprintf(pFile," value=\"%f\" ",dp->variables[i]->value); > if(dp->variables[i]->variableindex != NULL) > { > vi = dp->variables[i]->variableindex; > if(vi->type == CONSTANT) > fprintf( pFile , " typeIndex=\"%i\" " , vi->type_index); > fprintf( pFile , " index=\"%i\"/>\n" , vi->index); > } > } > } > fprintf(pFile, "</DesignPoint>\n" ); > > } > > > > SBML_ODESOLVER_API void DesignPoint_print(DesignPoint_t * dp) > { > int i; > variableIndex_t * vi; > printf("dimensions %i\n",dp->dimensions); > for(i =0; i < dp->dimensions; i++) > { > if(dp->variables[i] != NULL) > { > printf("id %s\n",dp->variables[i]->id); > printf("rid %s\n",dp->variables[i]->rid); > printf("value %f\n",dp->variables[i]->value); > if(dp->variables[i]->variableindex != NULL) > { > vi = dp->variables[i]->variableindex; > if(vi->type == CONSTANT) > printf("CONSTANT\n"); > printf("typeIndex %i\n",vi->type_index); > printf("index %i\n",vi->index); > } > } > printf("==============\n"); > } > } > > /**Add variable to Design point > \param dp DesignPoint_t > \param variable > \param dimension \< dp-> dimension */ > > SBML_ODESOLVER_API void DesignPoint_addDimension( DesignPoint_t * dp, Variable_t * variable, int dimension) > { > if( dimension >= 0 && dimension < dp->dimensions) > { > if((dp->variables[dimension]) != NULL) > { > Variable_free(dp->variables[dimension]); > } > dp->variables[dimension] = variable; > } > } > > /**Update all parameter values in the design point > * \param dp DesignPoint_t > * \param values new parameter values in logarithmic > */ > > SBML_ODESOLVER_API int DesignPoint_update(DesignPoint_t * dp, double * log_values) > { > int i; > for(i = 0; i< dp->dimensions; i++) > { > dp->variables[i]->value = exp(log_values[i]); > } > } > > /** Get all parameter values of a design point > * \param dp DesignPoint_t > * \return an array of doubles with the parameter values > */ > > SBML_ODESOLVER_API double * DesignPoint_getValues(DesignPoint_t * dp) > { > int i; > double *res = calloc(dp->dimensions, sizeof(double)); > for(i = 0; i < dp->dimensions; i++) > { > res[i] = dp->variables[i]->value; > } > return(res); > } > > > /** creates a variable > \param model SBML odeModel_t > \param value paramter value > \param char parameterStr Identifier > \param cahr reactionsStr Identifier > */ > > SBML_ODESOLVER_API Variable_t * OdeModel_getVariable( odeModel_t * odemodel > , double value, char * parameterStr , char * reactionStr ) > { > char * local_param; > variableIndex_t * variableindex; > Variable_t * variable; > int i; > if(odemodel != NULL) > { > if ( (reactionStr != NULL && strlen(reactionStr) > 0) ) > { > ASSIGN_NEW_MEMORY_BLOCK(local_param, > strlen(parameterStr) + strlen(reactionStr) + 4, > char , 0); > sprintf( local_param, "r_%s_%s", reactionStr , parameterStr ); > variableindex = ODEModel_getVariableIndex( odemodel, local_param ); > free( local_param ); > } > else > { > variableindex = ODEModel_getVariableIndex(odemodel, parameterStr); > } > if(variableindex !=NULL) > { > variable = VariableIndex_getVariable( variableindex , value , parameterStr , reactionStr ); > } > else > { > return(NULL); /*alternatively ? > return(Variable_create(value, parameterStr , reactionStr)); > */ > } > } > else > { > return(NULL); > } > return(variable); > } > > /**creates a variable from index*/ > SBML_ODESOLVER_API Variable_t * VariableIndex_getVariable( variableIndex_t * vi, double value, char *parameterStr , char *reactionStr) > { > Variable_t * variable; > char * local_param; > ASSIGN_NEW_MEMORY(variable, struct Variable, NULL); > ASSIGN_NEW_MEMORY(variable->variableindex, variableIndex_t, NULL); > > variable->variableindex->type = vi->type; > variable->variableindex->type_index = vi->type_index; > variable->variableindex->index = vi->index; > > if(reactionStr != NULL && strlen(reactionStr) > 0 ) > { > ASSIGN_NEW_MEMORY_BLOCK(variable->rid, strlen(reactionStr)+1, char, 0); > sprintf(variable->rid, "%s", reactionStr); > } > else > variable->rid = NULL; > if( parameterStr != NULL && strlen(parameterStr) > 0 ) > { > ASSIGN_NEW_MEMORY_BLOCK(variable->id, strlen(parameterStr)+1, char, 0); > sprintf(variable->id, "%s", parameterStr); > } > else > variable->id = NULL; > > variable->value = value; > return(variable); > } > > /** Remove struct Variable_t from memory*/ > > SBML_ODESOLVER_API void Variable_free( Variable_t *variable ) > { > if(variable != NULL) > { > if(variable->id != NULL) > free(variable->id); > if(variable->rid != NULL) > free(variable->rid); > if(variable->variableindex != NULL) > VariableIndex_free(variable->variableindex); > free(variable); > } > } > > SBML_ODESOLVER_API Variable_t * Variable_clone( Variable_t * variable_old ) > { > Variable_t * variable; > char * local_param; > > ASSIGN_NEW_MEMORY(variable, struct Variable, NULL); > variable->variableindex = variable_old->variableindex; > > if(variable_old->rid != NULL && strlen(variable_old->rid) > 0 ) > { > ASSIGN_NEW_MEMORY_BLOCK(variable->rid, strlen(variable_old->rid)+1, char, 0); > sprintf(variable->rid, "%s", variable_old->rid); > } > else > variable->rid = NULL; > if( variable_old->id != NULL && strlen(variable_old->id) > 0 ) > { > ASSIGN_NEW_MEMORY_BLOCK(variable->id, strlen(variable_old->id)+1, char, 0); > sprintf(variable->id, "%s", variable_old->id); > } > else > variable->id = NULL; > variable->value = variable_old->value; > return(variable); > } > > > SBML_ODESOLVER_API int IntegratorInstance_setDesignPoint(integratorInstance_t * integratorInstance, DesignPoint_t * designpoint) > { > int i = 0; > for(i = 0; i < designpoint->dimensions;i++) > { > if(designpoint->variables[i]->variableindex != NULL) > { > IntegratorInstance_setVariableValue(integratorInstance > , designpoint->variables[i]->variableindex > , designpoint->variables[i]->value); > } > else > { > return(-1); > } > } > return(1); > } > > > /** old style parameter scan -- working*/ > > /**Create a variable - Simple version, works only with old style parameter scan functions: Model_change and Model_solve*/ > SBML_ODESOLVER_API Variable_t * Variable_create( double value, char *parameterStr , char *reactionStr) > { > Variable_t * variable; > ASSIGN_NEW_MEMORY(variable, struct Variable, NULL); > > if(reactionStr != NULL && strlen(reactionStr) > 0 ) > { > ASSIGN_NEW_MEMORY_BLOCK(variable->rid, strlen(reactionStr)+1, char, 0); > sprintf(variable->rid, "%s", reactionStr); > } > else > variable->rid = NULL; > if( parameterStr != NULL && strlen(parameterStr) > 0 ) > { > ASSIGN_NEW_MEMORY_BLOCK(variable->id, strlen(parameterStr)+1, char, 0); > sprintf(variable->id, "%s", parameterStr); > } > else > variable->id = NULL; > > variable->value = value; > return(variable); > } > > > /** changes parameters in the Model_t representation */ > SBML_ODESOLVER_API int Model_change(Model_t *model, /*SBML level 2! See example*/ > DesignPoint_t *dp > ) > { > int i; > SBMLResults_t * results; > for(i=0;i < dp->dimensions; i++) > { > if ( ! Model_setValue(model, dp->variables[i]->id , dp->variables[i]->rid, dp->variables[i]->value)) > { > printf("Parameter %s \n", dp->variables[i]->id); > Warn(stderr, "Parameter for variation not found in the model.", dp->variables[i]->id); > return(0); > } > } > return(1); > } > > > SBML_ODESOLVER_API cvodeResults_t * Model_solve(Model_t * model, cvodeSettings_t *settings) > { > cvodeResults_t * results; > odeModel_t * odemodel = ODEModel_create(model); > integratorInstance_t * integratorInstance; > RETURN_ON_FATALS_WITH(NULL); > > /** > Second, an integratorInstance is created from the odeModel > and the passed cvodeSettings. If that worked out ... > */ > > integratorInstance = IntegratorInstance_create(odemodel, settings); > RETURN_ON_FATALS_WITH(NULL); > > /** .... the integrator loop can be started, > that invoking CVODE to move one time step and store. > The function will also handle events and > check for steady states. > */ > > while(!IntegratorInstance_timeCourseCompleted(integratorInstance)) > { > IntegratorInstance_integrateOneStep(integratorInstance); > RETURN_ON_ERRORS_WITH(NULL); > } > > results = IntegratorInstance_createResults(integratorInstance); > > /* free integration data */ > IntegratorInstance_free(integratorInstance); > /* free odeModel */ > ODEModel_free(odemodel); > /* ... well done. */ > return(results); > } > > > > /* test */ > > > > > ------------------------------------------------------------------------ > > /* > Last changed Time-stamp: <2006-04-19 16:23:17 raim> > $Id: doxygenComments.c,v 1.00 2006/04/11 13:10:45 afinney Exp $ > */ > /* > * > * This library is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as published > * by the Free Software Foundation; either version 2.1 of the License, or > * any later version. > * > * This library is distributed in the hope that it will be useful, but > * WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF > * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and > * documentation provided hereunder is on an "as is" basis, and the > * authors have no obligations to provide maintenance, support, > * updates, enhancements or modifications. In no event shall the > * authors be liable to any party for direct, indirect, special, > * incidental or consequential damages, including lost profits, arising > * out of the use of this software and its documentation, even if the > * authors have been advised of the possibility of such damage. See > * the GNU Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public License > * along with this library; if not, write to the Free Software Foundation, > * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. > * > * The original code contained here was initially developed by: > * > * Witold Wolski > * > * Contributor(s): > * > */ > > #ifndef _VARYSETTINGS_H_ > #define _VARYSETTINGS_H_ > > > > #include <stdio.h> > #include <stdlib.h> > #include <string.h> > #include <string.h> > #include <time.h> > #include <math.h> > > #include <sbmlsolver/odeSolver.h> > #include <sbmlsolver/sbml.h> > #include <sbmlsolver/solverError.h> > #include <sbmlsolver/variableIndex.h> > #include <sbmlsolver/odeModel.h> > #include <sbml/SBMLTypes.h> > > #ifdef __cplusplus > extern "C" { > #endif > > typedef struct Variable Variable_t; > /** Structure of parameter value for parameter scan */ > struct Variable > { > char *id; /**< SBML ID of the species, compartment or parameter to be varied */ > char *rid; /**< SBML Reaction ID, if a local parameter is to be varied */ > variableIndex_t * variableindex; > double value; /**< two dimensional array with the design points */ > }; > > typedef struct DesignPoint DesignPoint_t; > > struct DesignPoint > { > Variable_t ** variables; /**< array of variables */ > int dimensions; /**< length of variable array*/ > }; > > SBML_ODESOLVER_API DesignPoint_t* DesignPoint_create(int dimensions); > SBML_ODESOLVER_API DesignPoint_t * DesignPoint_clone(DesignPoint_t * designpoint); > > SBML_ODESOLVER_API double * DesignPoint_getValues(DesignPoint_t * dp); > SBML_ODESOLVER_API void DesignPoint_free(DesignPoint_t* designpoint); > SBML_ODESOLVER_API void DesignPoint_addDimension( DesignPoint_t * dp, Variable_t * variable, int dimension); > SBML_ODESOLVER_API int DesignPoint_update(DesignPoint_t * dp, double * log_values); > SBML_ODESOLVER_API void DesignPoint_dumpXML(DesignPoint_t * dp, FILE *pFile); > > SBML_ODESOLVER_API Variable_t * OdeModel_getVariable( odeModel_t * odemodel , double value, char * parameterStr , char * reactionStr ); > SBML_ODESOLVER_API Variable_t * VariableIndex_getVariable( variableIndex_t * vi, double value, char *parameterStr , char *reactionStr); > SBML_ODESOLVER_API void Variable_free( Variable_t *variable ); > SBML_ODESOLVER_API int IntegratorInstance_setDesignPoint(integratorInstance_t * integratorInstance, DesignPoint_t * designpoint); > SBML_ODESOLVER_API Variable_t * Variable_create( double value, char *parameterStr , char *reactionStr); > SBML_ODESOLVER_API int Model_change(Model_t *model, /*SBML level 2! See example*/ > DesignPoint_t *dp); > SBML_ODESOLVER_API cvodeResults_t * Model_solve(Model_t * model , cvodeSettings_t *settings); > > #ifdef __cplusplus > } > #endif > > #endif // _VARYSETTINGS_H_ > > > ------------------------------------------------------------------------ > > /* > Last changed Time-stamp: <2005-12-16 16:28:40 raim> > $Id: Sense.c,v 1.2 2005/12/16 15:29:18 raimc Exp $ > */ > /* > * > * This library is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as published > * by the Free Software Foundation; either version 2.1 of the License, or > * any later version. > * > * This library is distributed in the hope that it will be useful, but > * WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF > * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and > * documentation provided hereunder is on an "as is" basis, and the > * authors have no obligations to provide maintenance, support, > * updates, enhancements or modifications. In no event shall the > * authors be liable to any party for direct, indirect, special, > * incidental or consequential damages, including lost profits, arising > * out of the use of this software and its documentation, even if the > * authors have been advised of the possibility of such damage. See > * the GNU Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public License > * along with this library; if not, write to the Free Software Foundation, > * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. > * > * The original code contained here was initially developed by: > * > * Witold Wolski > * > * Contributor(s): > */ > > #include <stdio.h> > #include <malloc.h> > #include <math.h> > #include <stdlib.h> > #include <ctype.h> > #include <string.h> > > #include "sbmlsolver/integratorInstance.h" > #include "sbmlsolver/solverError.h" > #include "sbmlsolver/varySettings.h" > #include <sbml/SBMLTypes.h> > > > int testVariable() > { > Variable_t * variable; > printf("in testVariable\n"); > variable = Variable_create(2.0,"V1",NULL); > Variable_free(variable); > } > > int testDesignPoint() > { > Variable_t * variable; > DesignPoint_t * designpoint; > printf("in testDesignPoint\n"); > variable = Variable_create(2.0,"V1",NULL); > designpoint = DesignPoint_create(5); > DesignPoint_addDimension(designpoint,variable,0); > DesignPoint_free(designpoint); > } > > /**Example with fast version of parameter change*/ > int doit3() > { > Variable_t *v1,*v2,*v3,*v4,*v5; > variableIndex_t *y1; > integratorInstance_t * integratorInstance; > DesignPoint_t * dp; > cvodeSettings_t * cs; > cvodeResults_t * cvoderesults; > odeModel_t * odemodel; > char * modelStr = "MAPK.xml"; > SBMLDocument_t * d2, * document = readSBML( modelStr ); > Model_t * model; > int i=0, j=0, k=0; > > /* char *model; */ > if ( SBMLDocument_getLevel(document) == 1 ) > { > d2 = convertModel(document); > model = SBMLDocument_getModel(d2); > } > else > { > model = SBMLDocument_getModel(document); > } > > /*first do globalise the paramters*/ > > globalizeParameter(model,"V2","J1"); > globalizeParameter(model,"KK2","J1"); > odemodel = ODEModel_create(model); > > dp = DesignPoint_create(5); /*create design point with 5 dimensions*/ > v1 = OdeModel_getVariable(odemodel, 2.0, "V1", NULL); > DesignPoint_addDimension(dp,v1,0); > v2 = OdeModel_getVariable(odemodel, 8.0, "Ki", NULL); > DesignPoint_addDimension(dp,v2,1); > v3 = OdeModel_getVariable(odemodel,10.0,"K1",NULL); > DesignPoint_addDimension(dp,v3,2); > v4 = OdeModel_getVariable(odemodel,.1,"V2","J1"); > DesignPoint_addDimension(dp,v4,3); > v5 = OdeModel_getVariable(odemodel, 2.0,"KK2","J1"); > DesignPoint_addDimension(dp,v5,4); > DesignPoint_print(dp); > printf("\n\n"); > > y1 = ODEModel_getVariableIndex(odemodel,"MKK_P"); > > /*DesignPoint_print(dp);*/ > cs = CvodeSettings_create(); > CvodeSettings_setTime(cs, 300, 10); > CvodeSettings_setErrors(cs, 1e-9, 1e-4, 1000); > CvodeSettings_setStoreResults(cs, 1); > CvodeSettings_setSensitivity(cs,1); > > /*res = Model_odeSolverDesing(model,cs,dp); > printf("num sens %d\n",SBMLResults_getNumSens(res));*/ > > RETURN_ON_FATALS_WITH(1); > integratorInstance = IntegratorInstance_create(odemodel,cs); > IntegratorInstance_setDesignPoint(integratorInstance,dp); > > IntegratorInstance_dumpNames(integratorInstance); > > printf("nsens %d \n", integratorInstance->data->nsens); > printf("neq %d \n", integratorInstance->data->neq); > printf("nvalues %d \n", integratorInstance->data->nvalues); > > while (!IntegratorInstance_timeCourseCompleted(integratorInstance)) > { > IntegratorInstance_integrateOneStep(integratorInstance); > > /* > IntegratorInstance_dumpPSensitivities(integratorInstance,v1->variableindex); > IntegratorInstance_dumpYSensitivities(integratorInstance,y1); > */ > > for(i = 0; i < integratorInstance->data->neq; i++) > { > for(j=0; j < integratorInstance->data-> nsens; j++) > { > printf("%f \t",integratorInstance->data->sensitivity[i][j]); > } > printf("\n"); > } > printf("\n\n\n"); > /* > IntegratorInstance_dumpPSensitivities(integratorInstance,v2->variableindex); > IntegratorInstance_dumpYSensitivities(integratorInstance,y2); > /* > IntegratorInstance_dumpPSensitivities(integratorInstance,v3->variableindex); > IntegratorInstance_dumpPSensitivities(integratorInstance,v4->variableindex); > IntegratorInstance_dumpPSensitivities(integratorInstance,v5->variableindex); > */ > RETURN_ON_ERRORS_WITH(1); > } > > cvoderesults = IntegratorInstance_createResults(integratorInstance); > printf("Printing cvoderesults\n==============================\n"); > > for(k = 0; k <= cvoderesults->nout; k++) > { > for(i = 0; i < cvoderesults->neq; i++) > { > for(j=0; j < cvoderesults->nsens; j++) > { > printf("%f \t",cvoderesults->sensitivity[i][j][k]); > } > printf("\n"); > } > printf("\n\n\n"); > } > IntegratorInstance_free(integratorInstance); > DesignPoint_free(dp); > ODEModel_free(odemodel); > SBMLDocument_free(d2); > SBMLDocument_free(document); > return(1); > } > > > int main(int argc, char *argv[]) > { > int result = testVariable(); > result = testDesignPoint(); > result = doit3(); > printf("done3\n"); > return( result ); > } > > > > ------------------------------------------------------------------------ > > /* > Last changed Time-stamp: <2005-12-16 16:28:40 raim> > $Id: Sense.c,v 1.2 2005/12/16 15:29:18 raimc Exp $ > */ > /* > * > * This library is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as published > * by the Free Software Foundation; either version 2.1 of the License, or > * any later version. > * > * This library is distributed in the hope that it will be useful, but > * WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF > * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and > * documentation provided hereunder is on an "as is" basis, and the > * authors have no obligations to provide maintenance, support, > * updates, enhancements or modifications. In no event shall the > * authors be liable to any party for direct, indirect, special, > * incidental or consequential damages, including lost profits, arising > * out of the use of this software and its documentation, even if the > * authors have been advised of the possibility of such damage. See > * the GNU Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public License > * along with this library; if not, write to the Free Software Foundation, > * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. > * > * The original code contained here was initially developed by: > * > * Witold Wolski > * > * Contributor(s): > */ > > #include <stdio.h> > #include <malloc.h> > #include <math.h> > #include <stdlib.h> > #include <ctype.h> > #include <string.h> > > #include "sbmlsolver/integratorInstance.h" > #include "sbmlsolver/solverError.h" > #include "sbmlsolver/varySettings.h" > #include <sbml/SBMLTypes.h> > > > > > void myODEModel_dumpNames(odeModel_t *om) > { > int i; > printf("myODEModel_dumpNames\n"); > for ( i=(om->neq+om->nass+1); i<(om->neq+om->nass+om->nconst+om->nalg); i++ ) > printf("%s ", om->names[i]); > printf("\n"); > } > > /**Example with fast version of parameter change*/ > > int doit3() > { > Variable_t *v1,*v2,*v3,*v4,*v5; > variableIndex_t *y1; > integratorInstance_t * integratorInstance; > DesignPoint_t * dp; > cvodeSettings_t * cs; > cvodeResults_t * cvoderesults; > odeModel_t * odemodel; > char * modelStr = "MAPK.xml"; > SBMLDocument_t * d2, * document = readSBML( modelStr ); > Model_t * model; > int i=0, j=0, k=0; > > /* char *model; */ > if ( SBMLDocument_getLevel(document) == 1 ) > { > d2 = convertModel(document); > model = SBMLDocument_getModel(d2); > } > else > { > model = SBMLDocument_getModel(document); > } > > /*first do globalise the paramters*/ > > globalizeParameter(model,"V2","J1"); > globalizeParameter(model,"KK2","J1"); > odemodel = ODEModel_create(model); > > dp = DesignPoint_create(5); /*create design point with 5 dimensions*/ > v1 = OdeModel_getVariable(odemodel, 2.0, "V1", NULL); > DesignPoint_addDimension(dp,v1,0); > v2 = OdeModel_getVariable(odemodel, 8.0, "Ki", NULL); > DesignPoint_addDimension(dp,v2,1); > v3 = OdeModel_getVariable(odemodel,10.0,"K1",NULL); > DesignPoint_addDimension(dp,v3,2); > v4 = OdeModel_getVariable(odemodel,.1,"V2","J1"); > DesignPoint_addDimension(dp,v4,3); > v5 = OdeModel_getVariable(odemodel, 2.0,"KK2","J1"); > DesignPoint_addDimension(dp,v5,4); > DesignPoint_print(dp); > printf("\n\n"); > > y1 = ODEModel_getVariableIndex(odemodel,"MKK_P"); > > /*DesignPoint_print(dp);*/ > cs = CvodeSettings_create(); > CvodeSettings_setTime(cs, 300, 10); > CvodeSettings_setErrors(cs, 1e-9, 1e-4, 1000); > CvodeSettings_setStoreResults(cs, 1); > CvodeSettings_setSensitivity(cs,1); > > /*res = Model_odeSolverDesing(model,cs,dp); > printf("num sens %d\n",SBMLResults_getNumSens(res));*/ > > RETURN_ON_FATALS_WITH(1); > integratorInstance = IntegratorInstance_create(odemodel,cs); > IntegratorInstance_setDesignPoint(integratorInstance,dp); > > printf("5 Global parameters\n"); > myODEModel_dumpNames(integratorInstance->om); > > printf("nsens (sensitivities) %d \n", integratorInstance->data->nsens); > printf("neq (equations) %d \n", integratorInstance->data->neq); > printf("nvalues %d \n", integratorInstance->data->nvalues); > > while (!IntegratorInstance_timeCourseCompleted(integratorInstance)) > { > IntegratorInstance_integrateOneStep(integratorInstance); > > /* > for(i = 0; i < integratorInstance->data->neq; i++) > { > for(j = 1; j < integratorInstance->data-> nsens; j++) > { > printf("%f \t",integratorInstance->data->sensitivity[i][j]); > } > printf("\n"); > } > printf("\n\n\n"); > */ > > /* > IntegratorInstance_dumpPSensitivities(integratorInstance,v1->variableindex); > IntegratorInstance_dumpYSensitivities(integratorInstance,y1); > IntegratorInstance_dumpPSensitivities(integratorInstance,v2->variableindex); > IntegratorInstance_dumpYSensitivities(integratorInstance,y2); > IntegratorInstance_dumpPSensitivities(integratorInstance,v3->variableindex); > IntegratorInstance_dumpPSensitivities(integratorInstance,v4->variableindex); > IntegratorInstance_dumpPSensitivities(integratorInstance,v5->variableindex); > */ > > RETURN_ON_ERRORS_WITH(1); > } > > cvoderesults = IntegratorInstance_createResults(integratorInstance); > printf("Printing cvoderesults\n==============================\n"); > > for(k = 1; k <= cvoderesults->nout; k++) > { > for(i = 0; i < cvoderesults->neq; i++) > { > for(j=1; j < cvoderesults->nsens; j++) > { > printf("%f \t",cvoderesults->sensitivity[i][j][k]); > } > printf("\n"); > } > printf("\n\n\n"); > } > > IntegratorInstance_free(integratorInstance); > DesignPoint_free(dp); > ODEModel_free(odemodel); > SBMLDocument_free(d2); > SBMLDocument_free(document); > return(1); > } > > int main(int argc, char *argv[]) > { > int result; > result = doit3(); > printf("done3\n"); > return( result ); > } > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > ------------------------------------------------------------------------ > > _______________________________________________ > sbmlsolver-devel mailing list > sbm...@li... > https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel |