get_varpriority

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

int get_varpriority(lprec *lp, int column);

Return Value

get_varpriority returns the priority of the variable.

Parameters

lp

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

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_varpriority function returns the priority the variable has in the branch-and-bound algorithm. This priority is determined by the weights set by set_varweights. The default priorities are the column positions of the variables in the model.

Example

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

int main(void)
{
  lprec *lp;
  REAL weights[1+2]; /* must be 1 more than number of columns */
  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[1] = 2;
  weights[2] = 1;

  set_varweights(lp, weights);

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

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS, set_varweights, get_var_branch, set_var_branch, set_floor_first, get_floor_first