Initializing help system before first use

Purchase - Definition of SOS-2


Type: Purchasing with pricebreaks
Rating: 3
Description: A model for optimal purchasing with price-breaks featuring a complex MIP model, data input from file and using SOS-2.
File(s): xbpurch.c
Data file(s): params.dat, maxperc.dat, required.dat, pricebk.dat


xbpurch.c
/********************************************************
  BCL Example Problems
  ====================

  file xbpurch.c
  ``````````````
  Purchasing problem.
  Using SOS-2.

  (c) 2008 Fair Isaac Corporation
      author: S.Heipcke, Jan. 2000, rev. Mar. 2011
********************************************************/

/* WARNING. This model is not for the novice, but it does contain many  *
 * useful ideas.                            *
 * The formulation is tricky because the discounts are all-quantity, so *
 * the graph of cost against quantity purchased is discontinuous.   *
 * To maintain sanity in the special ordered set formulation, we must   *
 * coarsen the discontinuity by stopping purchases just at the break point. */
 
#include 
#include 
#include "xprb.h"

#define PARAMSFILE  XPRBDATAPATH "/purchase/params.dat"
#define MAXPERCFILE XPRBDATAPATH "/purchase/maxperc.dat"
#define REQFILE     XPRBDATAPATH "/purchase/required.dat"
#define PRICEFILE   XPRBDATAPATH "/purchase/pricebk.dat"

/****TABLES****/
int NS;             /* Number of suppliers */
int NB;             /* Number of price breaks */
int NB2;            /* Useful parameter */

double **UC;        /* Unit cost */
double **BR;        /* Breakpoints (quantities at which unit cost changes) */
double **X;         /* Coarsened break points */
double **C;         /* Total cost at break points */
double *DELTA;      /* Coarsening factors */
double *MAXPERC;    /* Maximum percentage from each supplier */
double REQ;         /* Total quantity required */

double delta = 0.10;   /* Base coarsening factor */
                    
/***********************************************************************/

void modpurchase(XPRBprob prob)
{
 XPRBctr *refrow, cobj,ctr;
 int s,b;
 XPRBvar *x,**lam;
 XPRBsos sos2;
 
/****VARIABLES****/
 x=(XPRBvar *)malloc(NS*sizeof(XPRBvar));
 for(s=0;s