#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "glpk.h"
void callback_func(glp_tree *tree, void *info) {
int currentnode = 0;
int precnode = 0;
int nextnode = 0;
int treesize = 0;
int upnode = 0;
int nodelevel = 0;
switch (glp_ios_reason(tree)) {
case GLP_IBRANCH:
glp_ios_tree_size(tree, NULL, NULL, &treesize);
currentnode = glp_ios_curr_node(tree);
if(currentnode >0)
{
nodelevel = glp_ios_node_level(tree, currentnode);
upnode = glp_ios_up_node(tree, currentnode);
precnode = glp_ios_next_node(tree, currentnode);
nextnode = glp_ios_prev_node(tree, currentnode);
printf("\n treesize: %d",treesize);
printf("\n node level: %d",nodelevel);
printf("\n up node: %d",upnode);
printf("\n current node: %d",currentnode);
printf("\n prev node: %d",precnode);
printf("\n next node: %d\n",nextnode);
}
break;
default:
break;
}
}
glp_prob *lp=lpx_create_prob();
glp_iocp parm;
glp_read_lp(lp, NULL, input);
lpx_set_int_parm(lp, LPX_K_OUTFRQ, 1);
glp_init_iocp(&parm);
parm.cb_func = callback_func;
parm.cb_size=255;
parm.presolve=GLP_ON;
parm.pp_tech=GLP_PP_NONE;
int intopt = glp_intopt(lp, &parm);
return 0;
}
@@@ I get "input" from argv[].
###########################################
Not in this problem but in other problems i have wrong node list, i have that some current nodes have more than 1 up node and that is wrong, and some up nodes have more than 2 "children".
What I'm doing wrong?
Please anyone could help me?
Kind Regards,
IG