LPP *lpp_create_wksp(void) { LPP *lpp; lpp = umalloc(sizeof(LPP)); lpp->orig_m = 0; lpp->orig_n = 0; lpp->orig_nnz = 0; lpp->orig_dir = LPX_MIN; lpp->nrows = 0; lpp->ncols = 0; lpp->row_pool = dmp_create_pool(sizeof(LPPROW)); lpp->col_pool = dmp_create_pool(sizeof(LPPCOL)); lpp->aij_pool = dmp_create_pool(sizeof(LPPAIJ)); lpp->row_ptr = NULL; lpp->col_ptr = NULL; lpp->row_que = NULL; lpp->col_que = NULL; lpp->c0 = 0.0; lpp->tqe_pool = dmp_create_pool(0); lpp->tqe_list = NULL; lpp->m = 0; lpp->n = 0; lpp->nnz = 0; lpp->row_ref = NULL; lpp->col_ref = NULL; lpp->row_stat = NULL; lpp->row_prim = NULL; lpp->row_dual = NULL; lpp->col_stat = NULL; lpp->col_prim = NULL; lpp->col_dual = NULL; return lpp; }
NPP *npp_create_wksp(void) { /* create LP/MIP preprocessor workspace */ NPP *npp; npp = xmalloc(sizeof(NPP)); npp->orig_dir = 0; npp->orig_m = npp->orig_n = npp->orig_nnz = 0; npp->pool = dmp_create_pool(); npp->name = npp->obj = NULL; npp->c0 = 0.0; npp->nrows = npp->ncols = 0; npp->r_head = npp->r_tail = NULL; npp->c_head = npp->c_tail = NULL; npp->stack = dmp_create_pool(); npp->top = NULL; #if 0 /* 16/XII-2009 */ memset(&npp->count, 0, sizeof(npp->count)); #endif npp->m = npp->n = npp->nnz = 0; npp->row_ref = npp->col_ref = NULL; npp->sol = npp->scaling = 0; npp->p_stat = npp->d_stat = npp->t_stat = npp->i_stat = 0; npp->r_stat = NULL; /*npp->r_prim =*/ npp->r_pi = NULL; npp->c_stat = NULL; npp->c_value = /*npp->c_dual =*/ NULL; return npp; }
static void create_prob(glp_prob *lp) { lp->pool = dmp_create_pool(); lp->cps = xmalloc(sizeof(struct LPXCPS)); lpx_reset_parms(lp); lp->tree = NULL; /* LP/MIP data */ lp->name = NULL; lp->obj = NULL; lp->dir = GLP_MIN; lp->c0 = 0.0; lp->m_max = 100; lp->n_max = 200; lp->m = lp->n = 0; lp->nnz = 0; lp->row = xcalloc(1+lp->m_max, sizeof(GLPROW *)); lp->col = xcalloc(1+lp->n_max, sizeof(GLPCOL *)); lp->r_tree = lp->c_tree = NULL; /* basis factorization */ lp->valid = 0; lp->head = xcalloc(1+lp->m_max, sizeof(int)); lp->bfcp = NULL; lp->bfd = NULL; /* basic solution (LP) */ lp->pbs_stat = lp->dbs_stat = GLP_UNDEF; lp->obj_val = 0.0; lp->it_cnt = 0; lp->some = 0; /* interior-point solution (LP) */ lp->ipt_stat = GLP_UNDEF; lp->ipt_obj = 0.0; /* integer solution (MIP) */ lp->mip_stat = GLP_UNDEF; lp->mip_obj = 0.0; return; }
static void create_graph(glp_graph *G, int v_size, int a_size) { G->pool = dmp_create_pool(); G->name = NULL; G->nv_max = 50; G->nv = G->na = 0; G->v = xcalloc(1+G->nv_max, sizeof(glp_vertex *)); G->index = NULL; G->v_size = v_size; G->a_size = a_size; return; }
AVL *avl_create_tree(int (*fcmp)(void *info, const void *key1, const void *key2), void *info) { /* create AVL tree */ AVL *tree; tree = xmalloc(sizeof(AVL)); tree->pool = dmp_create_pool(); tree->root = NULL; tree->fcmp = fcmp; tree->info = info; tree->size = 0; tree->height = 0; return tree; }
SCG *scg_create_graph(int n) { /* create cliqued graph */ SCG *g; xassert(n >= 0); g = xmalloc(sizeof(SCG)); g->pool = dmp_create_pool(); g->n_max = 50; g->nc_max = 10; g->n = g->nc = 0; g->i_ptr = xcalloc(1+g->n_max, sizeof(SCGRIB *)); g->j_ptr = xcalloc(1+g->n_max, sizeof(SCGRIB *)); g->c_ptr = xcalloc(1+g->nc_max, sizeof(SCGCQE *)); g->v_ptr = xcalloc(1+g->n_max, sizeof(SCGCQE *)); g->flag = xcalloc(1+g->n_max, sizeof(char)); if (n > 0) scg_add_nodes(g, n); return g; }
CFG *cfg_create_graph(int n, int nv_max) { CFG *G; xassert(n >= 0); xassert(0 <= nv_max && nv_max <= n + n); G = talloc(1, CFG); G->n = n; G->pos = talloc(1+n, int); memset(&G->pos[1], 0, n * sizeof(int)); G->neg = talloc(1+n, int); memset(&G->neg[1], 0, n * sizeof(int)); G->pool = dmp_create_pool(); G->nv_max = nv_max; G->nv = 0; G->ref = talloc(1+nv_max, int); G->vptr = talloc(1+nv_max, CFGVLE *); G->cptr = talloc(1+nv_max, CFGCLE *); return G; }
SPM *spm_create_mat(int m, int n) { SPM *A; xassert(0 <= m && m < INT_MAX); xassert(0 <= n && n < INT_MAX); A = xmalloc(sizeof(SPM)); A->m = m; A->n = n; if (m == 0 || n == 0) { A->pool = NULL; A->row = NULL; A->col = NULL; } else { int i, j; A->pool = dmp_create_pool(); A->row = xcalloc(1+m, sizeof(SPME *)); for (i = 1; i <= m; i++) A->row[i] = NULL; A->col = xcalloc(1+n, sizeof(SPME *)); for (j = 1; j <= n; j++) A->col[j] = NULL; } return A; }
void *gmp_get_atom(int size) { if (gmp_pool == NULL) gmp_pool = dmp_create_pool(); return dmp_get_atom(gmp_pool, size); }
MPL *mpl_initialize(void) { MPL *mpl; mpl = umalloc(sizeof(MPL)); /* scanning segment */ mpl->line = 0; mpl->c = 0; mpl->token = 0; mpl->imlen = 0; mpl->image = ucalloc(MAX_LENGTH+1, sizeof(char)); mpl->image[0] = '\0'; mpl->value = 0.0; mpl->b_token = 0; mpl->b_imlen = 0; mpl->b_image = ucalloc(MAX_LENGTH+1, sizeof(char)); mpl->b_image[0] = '\0'; mpl->b_value = 0.0; mpl->f_dots = 0; mpl->f_scan = 0; mpl->f_token = 0; mpl->f_imlen = 0; mpl->f_image = ucalloc(MAX_LENGTH+1, sizeof(char)); mpl->f_image[0] = '\0'; mpl->f_value = 0.0; mpl->context = ucalloc(CONTEXT_SIZE, sizeof(char)); memset(mpl->context, ' ', CONTEXT_SIZE); mpl->c_ptr = 0; mpl->flag_d = 0; /* translating segment */ mpl->pool = dmp_create_pool(0); mpl->tree = avl_create_tree(NULL, avl_strcmp); mpl->model = NULL; mpl->flag_x = 0; mpl->as_within = 0; mpl->as_in = 0; mpl->as_binary = 0; mpl->flag_s = 0; /* common segment */ mpl->strings = dmp_create_pool(sizeof(STRING)); mpl->symbols = dmp_create_pool(sizeof(SYMBOL)); mpl->tuples = dmp_create_pool(sizeof(TUPLE)); mpl->arrays = dmp_create_pool(sizeof(ARRAY)); mpl->members = dmp_create_pool(sizeof(MEMBER)); mpl->elemvars = dmp_create_pool(sizeof(ELEMVAR)); mpl->formulae = dmp_create_pool(sizeof(FORMULA)); mpl->elemcons = dmp_create_pool(sizeof(ELEMCON)); mpl->a_list = NULL; mpl->sym_buf = ucalloc(255+1, sizeof(char)); mpl->sym_buf[0] = '\0'; mpl->tup_buf = ucalloc(255+1, sizeof(char)); mpl->tup_buf[0] = '\0'; /* generating/postsolving segment */ mpl->rand = rng_create_rand(); mpl->flag_p = 0; mpl->stmt = NULL; mpl->m = 0; mpl->n = 0; mpl->row = NULL; mpl->col = NULL; /* input/output segment */ mpl->in_fp = NULL; mpl->in_file = NULL; mpl->out_fp = NULL; mpl->out_file = NULL; mpl->out_buf = NULL; mpl->out_cnt = 0; /* solver interface segment */ if (setjmp(mpl->jump)) insist(mpl != mpl); mpl->phase = 0; mpl->mod_file = NULL; mpl->mpl_buf = ucalloc(255+1, sizeof(char)); mpl->mpl_buf[0] = '\0'; return mpl; }