/[ascend]/trunk/base/generic/solver/analyze.c
ViewVC logotype

Diff of /trunk/base/generic/solver/analyze.c

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

revision 221 by johnpye, Wed Jan 25 07:44:41 2006 UTC revision 222 by johnpye, Fri Jan 27 04:23:20 2006 UTC
# Line 97  static symchar *g_strings[3]; Line 97  static symchar *g_strings[3];
97    
98  /*  /*
99      Forward declaration      Forward declaration
100   */  */
101  static void ProcessModelsInWhens(struct Instance *, struct gl_list_t *,  static void ProcessModelsInWhens(struct Instance *, struct gl_list_t *,
102                                   struct gl_list_t *, struct gl_list_t *);                                   struct gl_list_t *, struct gl_list_t *);
103    
104  /*  /*
105      Global variable. Set to true by classify if need be      Global variable. Set to true by classify if need be
106   */  */
107  static int g_bad_rel_in_list;  static int g_bad_rel_in_list;
108    
109    
# Line 200  static struct reuse_t { Line 200  static struct reuse_t {
200    struct solver_ipdata *ipbuf;    struct solver_ipdata *ipbuf;
201  } g_reuse = {0,0,NULL};  } g_reuse = {0,0,NULL};
202    
203  /*  /**
204      a data structure for bridge building only. hell of a scaffolding.      a data structure for bridge-building only. hell of a scaffolding.
205      all fields should be empty if construction is not in progress.      all fields should be empty if construction is not in progress.
206      In particular, do no operations that can throw an exception      In particular, do no operations that can throw an exception
207      while manipulating a problem_t, as it is way too big to let leak.      while manipulating a problem_t, as it is way too big to let leak.
208  */  */
209  struct problem_t {  struct problem_t {
210  /* the following are established by CountStuffInTree */  
211      /* the following are established by CountStuffInTree */
212    long nv;              /* number of solvervar/solveratom */    long nv;              /* number of solvervar/solveratom */
213    long np;              /* number of real ATOM instance parameters */    long np;              /* number of real ATOM instance parameters */
214    long nu;              /* number of real ATOM instance uninteresting */    long nu;              /* number of real ATOM instance uninteresting */
# Line 221  struct problem_t { Line 222  struct problem_t {
222    long nw;              /* number of whens */    long nw;              /* number of whens */
223    long ne;              /* number of external rels subset overestimate*/    long ne;              /* number of external rels subset overestimate*/
224    long nm;              /* number of models */    long nm;              /* number of models */
225  /*  
226      The following gllists contain pointers to interface ptrs as    /*
227      locally defined.      The following gllists contain pointers to interface ptrs as
228      The lists will be in order found by a visit instance tree.      locally defined.
229  */      The lists will be in order found by a visit instance tree.
230      */
231    struct gl_list_t *vars;   /* solvervar/solveratom. varips */    struct gl_list_t *vars;   /* solvervar/solveratom. varips */
232    struct gl_list_t *pars;   /* real ATOM instance parameters */    struct gl_list_t *pars;   /* real ATOM instance parameters */
233    struct gl_list_t *unas;   /* real ATOM instance of no 'apparent' use */    struct gl_list_t *unas;   /* real ATOM instance of no 'apparent' use */
234    struct gl_list_t *models; /* models in tree. modips */    struct gl_list_t *models; /* models in tree. modips */
235  /*  
236      The following gllists contain pointers to interface ptrs as    /*
237      locally defined.      The following gllists contain pointers to interface ptrs as
238      The lists will be in order found by running over the models list.      locally defined.
239  */      The lists will be in order found by running over the models list.
240      */
241    struct gl_list_t *dvars;  /* discrete variables */    struct gl_list_t *dvars;  /* discrete variables */
242    struct gl_list_t *dunas;  /* discrete variables of no use */    struct gl_list_t *dunas;  /* discrete variables of no use */
243    struct gl_list_t *whens;  /* whens */    struct gl_list_t *whens;  /* whens */
# Line 243  struct problem_t { Line 246  struct problem_t {
246    struct gl_list_t *rels;   /* ascend relations. relips */    struct gl_list_t *rels;   /* ascend relations. relips */
247    struct gl_list_t *objrels;    /* objective rels. relips */    struct gl_list_t *objrels;    /* objective rels. relips */
248    struct gl_list_t *logrels;    /* logical rels */    struct gl_list_t *logrels;    /* logical rels */
249  /* bridge ip data */  
250      /* bridge ip data */
251    struct gl_list_t *oldips; /* buffer of oldip crap we're protecting */    struct gl_list_t *oldips; /* buffer of oldip crap we're protecting */
252  /* misc stuff */  
253      /* misc stuff */
254    struct gl_list_t *tmplist;    /* sort space */    struct gl_list_t *tmplist;    /* sort space */
255  /* stuff that will end up in the slv_system_t */  
256      /* stuff that will end up in the slv_system_t */
257    struct rel_relation *obj;        /* DEFAULT objective relation, if any */    struct rel_relation *obj;        /* DEFAULT objective relation, if any */
258    struct Instance *root;    /* instance we construct system from */    struct Instance *root;    /* instance we construct system from */
259    struct gl_list_t *extrels;    /* black box stub list */    struct gl_list_t *extrels;    /* black box stub list */
260  /* stuff that should move elsewhere, but end up in slv_system_t */  
261      /* stuff that should move elsewhere, but end up in slv_system_t */
262    mtx_region_t *blocks;     /* array of partitions in reordered matrix */    mtx_region_t *blocks;     /* array of partitions in reordered matrix */
263    int32 nblocks;        /* size of array of partitions */    int32 nblocks;        /* size of array of partitions */
264    int nnz;              /* free nonzeros in processed jacobian */    int nnz;              /* free nonzeros in processed jacobian */
# Line 266  struct problem_t { Line 273  struct problem_t {
273    int nrow;             /* included relations */    int nrow;             /* included relations */
274    /* conditional stuff */    /* conditional stuff */
275    int32 need_consistency;   /* Conistency analysis is required ? */    int32 need_consistency;   /* Conistency analysis is required ? */
276   /* logical relation stuff */  
277      /* logical relation stuff */
278    int lognnz;           /* Summ of free boolean vars in inc logrels */    int lognnz;           /* Summ of free boolean vars in inc logrels */
279    int lognrow;          /* included logrelations */    int lognrow;          /* included logrelations */
280    int logncol;          /* free and incident boolean vars */    int logncol;          /* free and incident boolean vars */
# Line 274  struct problem_t { Line 282  struct problem_t {
282    int lrelincsize;      /* Total summ of incidences (boolean vars)    int lrelincsize;      /* Total summ of incidences (boolean vars)
283                             in logrels*/                             in logrels*/
284    int lrelincinuse;     /* incidence given to log relations so far */    int lrelincinuse;     /* incidence given to log relations so far */
285  /* data to go to slv_system_t */  
286      /* data to go to slv_system_t */
287    struct rel_relation *reldata;      /* rel data space, mass allocated */    struct rel_relation *reldata;      /* rel data space, mass allocated */
288    struct rel_relation *objdata;      /* objrel data space, mass allocated */    struct rel_relation *objdata;      /* objrel data space, mass allocated */
289    struct rel_relation *condata;      /* cond rel data space, mass allocated*/    struct rel_relation *condata;      /* cond rel data space, mass allocated*/
# Line 317  struct problem_t { Line 326  struct problem_t {
326    
327    struct ExtRelCache **erlist;  /* external rel cache null terminated list */    struct ExtRelCache **erlist;  /* external rel cache null terminated list */
328  };  };
329    
330  /* we are making the ANSI assumption that this will be init to 0/NULL*/  /* we are making the ANSI assumption that this will be init to 0/NULL*/
331  /*  /*
332      container for globals during assembly.      container for globals during assembly.
# Line 351  struct problem_t { Line 361  struct problem_t {
361      having to do if testing while stuffing jacobians.      having to do if testing while stuffing jacobians.
362      In this scheme stuffing a jacobian row (or whatever) would simply mean      In this scheme stuffing a jacobian row (or whatever) would simply mean
363      calling the compiler's derivative function (wrt RelationVariable list)      calling the compiler's derivative function (wrt RelationVariable list)
364    
365        @code
366      which returns a vector d of values and then doing a loop:      which returns a vector d of values and then doing a loop:
367        for( i = 0 ; i < length; i++) { coord.row fixed already        for( i = 0 ; i < length; i++) { coord.row fixed already
368          coord.col = a[i++];          coord.col = a[i++];
369          mtx_fill_org_value(mtx,&coord,d[a[i]])          mtx_fill_org_value(mtx,&coord,d[a[i]])
370        }        }
371      }      }
372        @endcode
373    
374      One begins to wonder if there isn't a better way to do all this, but      One begins to wonder if there isn't a better way to do all this, but
375      so far nothing has occurred.      so far nothing has occurred.
# Line 601  static void CollectArrayRelsAndWhens(str Line 614  static void CollectArrayRelsAndWhens(str
614    }    }
615  }  }
616    
617    
618  /*  /*
619      Collect all the logrels/relations at the local scope of the MODEL      Collect all the logrels/relations at the local scope of the MODEL
620      associated with ip->i. Local scope includes arrays of logrels/relations,      associated with ip->i. Local scope includes arrays of logrels/relations,
# Line 1071  void CountStuffInTree(struct Instance *i Line 1084  void CountStuffInTree(struct Instance *i
1084        if( GetInstanceRelationOnly(inst) == NULL ||        if( GetInstanceRelationOnly(inst) == NULL ||
1085            GetInstanceRelationType(inst) == e_undefined) {            GetInstanceRelationType(inst) == e_undefined) {
1086      /* guard against null relations, unfinished ones */      /* guard against null relations, unfinished ones */
1087          error_reporter_start(ASC_USER_ERROR,NULL,0);          ERROR_REPORTER_START_NOLINE(ASC_USER_ERROR);
1088          FPRINTF(ASCERR,"Found bad (unfinished?) relation '");          FPRINTF(ASCERR,"Found bad (unfinished?) relation '");
1089          WriteInstanceName(ASCERR,inst,p_data->root);          WriteInstanceName(ASCERR,inst,p_data->root);
1090          FPRINTF(ASCERR,"' (in CountStuffInTree)");          FPRINTF(ASCERR,"' (in CountStuffInTree)");
# Line 1989  static int analyze_make_solvers_lists(st Line 2002  static int analyze_make_solvers_lists(st
2002          }          }
2003        }        }
2004        if (p_data->nnz==nnzold) {        if (p_data->nnz==nnzold) {
2005          error_reporter_start(ASC_USER_WARNING,NULL,0);          ERROR_REPORTER_START_NOLINE(ASC_USER_WARNING);
2006          FPRINTF(ASCERR,"No free variables in included relation '");          FPRINTF(ASCERR,"No free variables in included relation '");
2007          WriteInstanceName(ASCERR,rip->i,p_data->root);          WriteInstanceName(ASCERR,rip->i,p_data->root);
2008          FPRINTF(ASCERR,"'");          FPRINTF(ASCERR,"'");

Legend:
Removed from v.221  
changed lines
  Added in v.222

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