set_sense

Set objective function sense.

void set_sense(lprec *lp, unsigned char maximize);

Return Value

set_sense has no return value.

Parameters

lp

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

maximize

Set sense to minimize (FALSE) or maximize (TRUE).

Remarks

The set_sense function sets the objective sense. The default of lp_solve is to minimize, except for read_lp, read_LP where the default is to maximize.

Example

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

int main(void)
{
  lprec *lp;

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

  set_sense(lp, TRUE); /* set object sense to maximize */

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, read_lp, read_LP, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, set_minim, set_maxim, is_maxim