Math-LP-Solve

 view release on metacpan or  search on metacpan

Solve.i  view on Meta::CPAN

 /* Row[0] of the sparce matrix is the objective function */

  int       non_zeros;          /* The number of elements in the sparce matrix*/
  int       mat_alloc;		/* The allocated size for matrix sized 
				   structures */
  matrec    *mat;               /* mat_alloc :The sparse matrix */
  int       *col_end;           /* columns_alloc+1 :Cend[i] is the index of the
		 		   first element after column i.
				   column[i] is stored in elements 
				   col_end[i-1] to col_end[i]-1 */
  int       *col_no;            /* mat_alloc :From Row 1 on, col_no contains the
				   column nr. of the
                                   nonzero elements, row by row */
  short     row_end_valid;	/* true if row_end & col_no are valid */
  int       *row_end;           /* rows_alloc+1 :row_end[i] is the index of the 
				   first element in Colno after row i */
  double    *orig_rh;           /* rows_alloc+1 :The RHS after scaling & sign
				  changing, but before `Bound transformation' */
  double    *rh;		/* rows_alloc+1 :As orig_rh, but after Bound 
				   transformation */
  double    *rhs;		/* rows_alloc+1 :The RHS of the current
				   simplex tableau */
  short     *must_be_int;       /* sum_alloc+1 :TRUE if variable must be 
				   Integer */
  double    *orig_upbo;         /* sum_alloc+1 :Bound before transformations */
  double    *orig_lowbo;	/*  "       "                   */
  double    *upbo;              /*  " " :Upper bound after transformation &
				      B&B work */
  double    *lowbo;             /*  "       "  :Lower bound after transformation
				   & B&B work */

  short     basis_valid;        /* TRUE is the basis is still valid */
  int       *bas;               /* rows_alloc+1 :The basis column list */
  short     *basis;             /* sum_alloc+1 : basis[i] is TRUE if the column
				   is in the basis */
  short     *lower;             /*  "       "  :TRUE is the variable is at its 
				   lower bound (or in the basis), it is FALSE
				   if the variable is at its upper bound */

  short     eta_valid;          /* TRUE if current Eta structures are valid */
  int       eta_alloc;          /* The allocated memory for Eta */
  int       eta_size;           /* The number of Eta columns */
  int       num_inv;            /* The number of real pivots */
  int       max_num_inv;        /* ## The number of real pivots between 
				   reinversions */
  double    *eta_value;         /* eta_alloc :The Structure containing the
				   values of Eta */
  int       *eta_row_nr;         /*  "     "  :The Structure containing the Row
				   indexes of Eta */
  int       *eta_col_end;       /* rows_alloc + MaxNumInv : eta_col_end[i] is
				   the start index of the next Eta column */

  short	    bb_rule;		/* what rule for selecting B&B variables */

  short     break_at_int;       /* TRUE if stop at first integer better than
                                   break_value */
  double    break_value;        

  double    obj_bound;          /* ## Objective function bound for speedup of 
				   B&B */
  int       iter;               /* The number of iterations in the simplex
				   solver (LP) */
  int       total_iter;         /* The total number of iterations (B&B)
				   (ILP) */
  int       max_level;          /* The Deepest B&B level of the last solution */
  int	    total_nodes;	/* total number of nodes processed in b&b */
  double    *solution;          /* sum_alloc+1 :The Solution of the last LP, 
				   0 = The Optimal Value, 
                                   1..rows The Slacks, 
				   rows+1..sum The Variables */
  double    *best_solution;     /*  "       "  :The Best 'Integer' Solution */
  double    *duals;             /* rows_alloc+1 :The dual variables of the
				   last LP */
  
  short     maximise;           /* TRUE if the goal is to maximise the 
				   objective function */
  short     floor_first;        /* TRUE if B&B does floor bound first */
  short     *ch_sign;           /* rows_alloc+1 :TRUE if the Row in the matrix
				   has changed sign 
                                   (a`x > b, x>=0) is translated to 
				   s + -a`x = -b with x>=0, s>=0) */ 

  short     scaling_used;	/* TRUE if scaling is used */
  short     columns_scaled;     /* TRUE is the columns are scaled too, Only use
		 		   if all variables are non-integer */
  double    *scale;             /* sum_alloc+1:0..Rows the scaling of the Rows,
				   Rows+1..Sum the scaling of the columns */

  int	    nr_lagrange;	/* Nr. of Langrangian relaxation constraints */
  double    **lag_row;		/* NumLagrange, columns+1:Pointer to pointer of 
				   rows */
  double    *lag_rhs;		/* NumLagrange :Pointer to pointer of Rhs */
  double    *lambda;		/* NumLagrange :Lambda Values */
  short     *lag_con_type;      /* NumLagrange :TRUE if constraint type EQ */
  double    lag_bound;		/* the lagrangian lower bound */

  short     valid;		/* Has this lp pased the 'test' */
  double    infinite;           /* ## numerical stuff */
  double    epsilon;            /* ## */
  double    epsb;               /* ## */
  double    epsd;               /* ## */
  double    epsel;              /* ## */
  hashtable *rowname_hashtab;   /* hash table to store row names */
  hashtable *colname_hashtab;   /* hash table to store column names */
} lprec;

/* functions on lprec objects */
lprec* make_lp(int rows, int columns);
lprec* read_lp_file(FILE *input, short verbose = 0, char* lp_name = "no_name");
void delete_lp(lprec* lp);
lprec* copy_lp(lprec* lp);
void set_mat(lprec* lp, int row, int column, double value);
void set_obj_fn(lprec* lp, double* row);
void str_set_obj_fn(lprec* lp, char* row);
void add_constraint(lprec* lp, double* row, short constr_type, double rh);
void str_add_constraint(lprec* lp, char* row_string, short constr_type, double rh);
void del_constraint(lprec* lp,int del_row);
void add_lag_con(lprec* lp, double* row, short con_type, double rhs);
void str_add_lag_con(lprec* lp, char* row, short con_type, double rhs);
void add_column(lprec* lp, double* column);
void str_add_column(lprec* lp, char* col_string);
void del_column(lprec* lp, int column);
void set_upbo(lprec* lp, int column, double value);



( run in 0.798 second using v1.01-cache-2.11-cpan-71847e10f99 )