int user_dg_process_message(void *user, window *win, FILE *write_to) { cnrp_dg *win_cnrp = (cnrp_dg *)user; int msgtag; int length; int *xind; double *xval; receive_int_array(&msgtag, 1); switch (msgtag) { case CNRP_CTOI_DRAW_FRAC_GRAPH: receive_int_array(&length, 1); xind = (int *) malloc(length * ISIZE); xval = (double *) malloc(length * DSIZE); receive_int_array(xind, length); receive_dbl_array(xval, length); dg_freenet(win_cnrp->n); win_cnrp->n = dg_createnet(win->g.nodenum, length, xind, xval); FREE(xind); FREE(xval); dg_net_shrink_chains(win_cnrp->n); copy_network_into_graph(win_cnrp->n, &win->g); display_graph_on_canvas(win, write_to); break; } return(USER_SUCCESS); }
int user_receive_cg_data(void **user, int dg_id) { spp_cg_problem *spp; col_ordered *m; int colnum, rownum, info; spp = (spp_cg_problem *) calloc(1, sizeof(spp_cg_problem)); *user = spp; spp->par = (spp_cg_params *) calloc(1, sizeof(spp_cg_params)); receive_char_array((char *)spp->par, sizeof(spp_cg_params)); m = spp->cmatrix = (col_ordered *) calloc(1, sizeof(col_ordered)); receive_int_array(&m->colnum, 1); colnum = m->active_colnum = m->colnum; receive_int_array(&m->rownum, 1); rownum = m->rownum; receive_int_array(&m->nzcnt, 1); m->colnames = (int *) malloc(colnum * ISIZE); m->col_deleted = (char *) calloc(colnum/BITSPERBYTE + 1, CSIZE); /*calloc!*/ m->obj = (double *) malloc(colnum * DSIZE); m->matbeg = (int *) malloc((colnum + 1) * ISIZE); m->matind = (row_ind_type *) malloc(m->nzcnt * sizeof(row_ind_type)); receive_int_array(m->colnames, colnum); receive_dbl_array(m->obj, colnum); receive_int_array(m->matbeg, (colnum + 1)); receive_char_array((char *)m->matind, m->nzcnt * sizeof(row_ind_type)); spp->max_sol_length = rownum; /* allocate space for tmp arrays */ spp->tmp = (spp_cg_tmp *) calloc(1, sizeof(spp_cg_tmp)); spp->tmp->itmp_m = (int *) malloc(rownum * ISIZE); spp->tmp->istartmp_m = (int **) malloc(rownum * sizeof(int *)); spp->tmp->cuttmp = (cut_data *) calloc(1, sizeof(cut_data)); /* initialize cg data structures */ spp->fgraph = (frac_graph *) calloc(1, sizeof(frac_graph)); spp->cfgraph = (frac_graph *) calloc(1, sizeof(frac_graph)); spp->cm_frac = (col_ordered *) calloc(1, sizeof(col_ordered)); spp->rm_frac = (row_ordered *) calloc(1, sizeof(row_ordered)); spp->rm_frac->rmatbeg = (int *) malloc((rownum+1) * ISIZE); spp->lgraph = (level_graph *) calloc(1, sizeof(level_graph)); allocate_var_length_structures(spp, spp->max_sol_length); /* cut collection is a local cut pool that contains the cuts that have been sent back to the lp */ spp->cut_coll = (cut_collection *) calloc(1, sizeof(cut_collection)); spp->cut_coll->max_size = 1000; spp->cut_coll->cuts = (cut_data **) calloc(spp->cut_coll->max_size, sizeof(cut_data *)); spp->cut_coll->violation = (double *) malloc(spp->cut_coll->max_size * DSIZE); spp->cut_coll->mult = (int *) malloc(spp->cut_coll->max_size * ISIZE); return(USER_SUCCESS); }
void set_window_desc_pvm(int key, window *win) { win_desc *desc = &win->desc; switch ( key ) { case CANVAS_WIDTH: receive_int_array(&desc->canvas_width, 1); break; case CANVAS_HEIGHT: receive_int_array(&desc->canvas_height, 1); break; case VIEWABLE_WIDTH: receive_int_array(&desc->viewable_width, 1); break; case VIEWABLE_HEIGHT: receive_int_array(&desc->viewable_height, 1); break; case DISP_NODELABELS: receive_int_array(&desc->disp_nodelabels, 1); break; case DISP_NODEWEIGHTS: receive_int_array(&desc->disp_nodeweights, 1); break; case DISP_EDGEWEIGHTS: receive_int_array(&desc->disp_edgeweights, 1); break; case NODE_DASH: receive_str(desc->node_dash); break; case EDGE_DASH: receive_str(desc->edge_dash); break; case NODE_RADIUS: receive_int_array(&desc->node_radius, 1); break; case INTERACTIVE_MODE: receive_int_array(&desc->interactive_mode, 1); break; case MOUSE_TRACKING: receive_int_array(&desc->mouse_tracking, 1); break; case SCALE_FACTOR: receive_dbl_array(&desc->scale_factor, 1); break; case NODELABEL_FONT: receive_str(desc->nodelabel_font); break; case NODEWEIGHT_FONT: receive_str(desc->nodeweight_font); break; case EDGEWEIGHT_FONT: receive_str(desc->edgeweight_font); break; } }
int receive_feasible_solution_u(sym_environment *env, int msgtag) { receive_int_array(&(env->best_sol.xlevel), 1); receive_int_array(&(env->best_sol.xindex), 1); receive_int_array(&(env->best_sol.xiter_num), 1); receive_dbl_array(&(env->best_sol.lpetol), 1); receive_dbl_array(&(env->best_sol.objval), 1); receive_int_array(&(env->best_sol.xlength), 1); if (env->best_sol.xlength > 0){ FREE(env->best_sol.xind); FREE(env->best_sol.xval); env->best_sol.xind = (int *) malloc(env->best_sol.xlength * ISIZE); env->best_sol.xval = (double *) malloc(env->best_sol.xlength * DSIZE); receive_int_array(env->best_sol.xind, env->best_sol.xlength); receive_dbl_array(env->best_sol.xval, env->best_sol.xlength); } if (!env->has_ub || env->best_sol.objval < env->ub){ env->has_ub = TRUE; env->ub = env->best_sol.objval; } env->best_sol.has_sol = TRUE; switch (msgtag){ case FEASIBLE_SOLUTION_NONZEROS: break; case FEASIBLE_SOLUTION_USER: /* A feasible solution has been found in the LP process, and * it was packed by the user */ #ifdef USE_SYM_APPLICATION CALL_USER_FUNCTION( user_receive_feasible_solution(env->user, msgtag, env->best_sol.objval, env->best_sol.xlength, env->best_sol.xind, env->best_sol.xval) ); #endif break; } return(FUNCTION_TERMINATED_NORMALLY); }