get_var_priority

Returns, for the specified variable, the priority the variable has in the branch-and-bound algorithm.

int get_var_priority(lprec *lp, int column);

Return Value

get_var_priority returns the priority of the variable.

Parameters

lp

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

column

The column number of the variable on which the priority must be returned. It must be between 1 and the number of columns in the lp. If it is not within this range, the return value is 0

Remarks

The get_var_priority function returns the priority the variable has in the branch-and-bound algorithm. This priority is determined by the weights set by set_var_weights. The default priorities are the column positions of the variables in the model.

Example

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

int main(void)
{
  lprec *lp;
  REAL weights[2];
  int priority;

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

  weights[0] = 2;
  weights[1] = 1;

  set_var_weights(lp, weights);

  priority = get_var_priority(lp, 1); /* will return 2 */
  priority = get_var_priority(lp, 2); /* will return 1 */

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, read_lp, read_LP, read_lpt, read_LPT, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, set_var_weights, get_var_branch, set_var_branch, set_bb_floorfirst, get_bb_floorfirst