# put_bb_nodefunc

Allows to set a user function that specifies which non-integer variable to select next to make integer in the B&B solve.

void put_bb_nodefunc(lprec *lp, lphandleint_intfunc newnode, void *bbnodehandle);

Return Value

put_bb_nodefunc has no return value.

Parameters

lp

Pointer to previously created lp model. See return value of make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI

newnode

The node selection routine.
typedef int (__WINAPI lphandleint_intfunc)(lprec *lp, void *bb_nodehandle, int vartype);
The routine must return the node (column number) to make integer. vartype is at this moment always equal to BB_INT (1).
When 0 is returned then it indicates that all variables are integer.
When a negative value is returned, lp_solve will determine the next variable to make integer as if the routine is not set.
Note the __WINAPI attribute. This is important under Windows. It ensures __stdcall calling convention which is required.

bb_nodehandle

A parameter that will be provided to the node selection routine.

Remarks

Allows to set a user function that specifies which non-integer variable to select next to make integer in the B&B solve. Via this routine the user can implement his own rule to select the next non-integer variable to make integer. This overrules the setting of set_bb_rule.

Example

    #include <stdio.h>
    #include <stdlib.h>
    #include "lp_lib.h"

    int __WINAPI nodefunction(lprec *lp, void *bb_nodehandle, int vartype)
    {
     int node = -1;

     /* determine node to make integer */

     return(node);
    }

    int main(void)
    {
      lprec *lp;

      /* Create a new LP model */
      lp = make_lp(0, 1);
      if(lp == NULL) {
        fprintf(stderr, "Unable to create new LP model\n");
        return(1);
      }

      put_bb_nodefunc(lp, nodefunction, NULL);

      solve(lp);

      delete_lp(lp);
      return(0);
    }

lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, set_bb_rule