Dip  0.92.4
sym_primal_heuristics.h
Go to the documentation of this file.
1 /*===========================================================================*/
2 /* */
3 /* This file is part of the SYMPHONY MILP Solver Framework. */
4 /* */
5 /* SYMPHONY was jointly developed by Ted Ralphs (ted@lehigh.edu) and */
6 /* Laci Ladanyi (ladanyi@us.ibm.com). */
7 /* */
8 /* The author of this file is Ashutosh Mahajan */
9 /* */
10 /* (c) Copyright 2006-2019 Lehigh University. All Rights Reserved. */
11 /* */
12 /* This software is licensed under the Eclipse Public License. Please see */
13 /* accompanying file for terms. */
14 /* */
15 /*===========================================================================*/
16 
17 /*
18  * TODO:
19  * change ifdef _FEASI.. to ifdef _HEURISTICS
20  */
21 
22 #ifndef _PRIMAL_HEURISTICS_H
23 #define _PRIMAL_HEURISTICS_H
24 #include "sym_lp_solver.h"
25 #include "sym_lp.h"
26 #include "sym_types.h"
27 
28 /* feasibility pump */
29 typedef struct FP_VARS {
30  char is_bin;
31  char is_int;
32  int xplus;
33  int xminus;
34 }FPvars;
35 
36 typedef struct FP_DATA {
37  FPvars **fp_vars; /* an array of fp_vars */
38  int n0; /* no. of vars in orignial lp */
39  int m0;
40  int n; /* no. of vars in pumping lp */
41  int m; /* no. of constraints in pumping lp */
42  int iter;
44  int numInts;
45  int *index_list;
46  int **x_bar_ind; /* array containing previous x_bars */
47  double **x_bar_val; /* array containing previous x_bars */
48  int *x_bar_len; /* rounded x_lp */
49  double *alpha_p; /* previous alphas */
50  double *x_lp; /* solution of pumpling lp */
51  double *x_ip; /* rounded x_lp */
52  double *mip_obj; /* normalized original obj */
53  double *obj; /* obj function for pumping lp */
54  char can_check_sos; /* whether we can check sos rows while fixing bin vars */
55  char *sos_row_filled;/*to keep track of the sos variables while flipping */
56  char *sos_var_fixed_zero;/*to keep track of the sos variables while flipping */
57  double norm_c; /* norm of mip_obj */
58  double alpha;
59  double alpha_decr;
60  int verbosity;
61  double flip_fraction;
62  double norm;
63  int iterd;
66 }FPdata;
67 
68 /* solution pool */
69 int sp_add_solution PROTO((lp_prob *p, int cnt, int *indices, double *values, double obj_value, int bc_index));
70 int sp_delete_solution PROTO((sp_desc *sp, int position));
71 int sp_is_solution_in_sp PROTO((lp_prob *p, int cnt, int *indices, double *values, double obj_value));
72 #ifdef COMPILE_IN_LP
73 int sp_initialize(tm_prob *tm);
74 #endif
75 int sp_free_sp(sp_desc *sp);
76 
77 /* feasibility pump */
78 int feasibility_pump (lp_prob *p, char *found_better_solution, double &solution_value,
79  double *colSolution, double *betterSolution);
80 int fp_round (lp_prob *p, FPdata *fp_data, LPdata *lp_data);
81 int fp_is_feasible (LPdata *lp_data, const CoinPackedMatrix *matrix, const double *r_low, const double *r_up, FPdata *fp_data, char *is_feasible );
82 int fp_initialize_lp_solver(lp_prob *p, LPdata *new_lp_data, FPdata *fp_data,
83  double *colSolution);
84 int fp_solve_lp(LPdata *lp_data, FPdata *fp_data, char *is_feasible) ;
85 int fp_should_call_fp(lp_prob *p, int branching, int *should_call,
86  char is_last_iter, double t_lb);
87 int fp_add_obj_row(LPdata *new_lp_data, int n, const double *obj, double rhs);
88 int fp_can_sos_var_fix(lp_prob *p, FPdata *fp_data, int ind, int *filled_row_count);
89 int fp_fix_sos_var(lp_prob *p, FPdata *fp_data, int ind);
90 
91 /* rounding */
92 int round_solution PROTO((lp_prob *p, LPdata *lp_data, double *solution_value,
93  double *betterSolution, double t_lb));
94 /* shifting */
95 int shift_solution PROTO((lp_prob *p, LPdata *lp_data, double *solution_value,
96  double *betterSolution, double t_lb));
97 /* local search */
98 int apply_local_search PROTO((lp_prob *p, double *solution_value,
99  double *col_solution, double *better_solution, double *dual_gap, double t_lb));
100 int local_search PROTO((lp_prob *p, double *solution_value,
101  double *col_solution, double *better_solution, double t_lb));
102 
103 /* diving search */
104 int diving_search PROTO((lp_prob *p, double *solutionValue, double *colSolution,
105  double *betterSolution, char is_last_iter, double t_lb));
106 int ds_fix_vars PROTO((lp_prob *p, LPdata *diving_lp, double *x,
107  int *frac_ind, int frac_cnt, int d_fixed_cnt, int fix_incr_cnt,
108  int d_type, double *obj, double *ip_sol, double *x_rank,
109  char *direction, int *min_ind, char *min_dir, char should_fix));
110 
111 int ds_get_frac_vars PROTO((LPdata *lp_data, double *x, int *indices,
112  int *frac_ip_cnt, int *int_ip_cnt));
113 
114 int ds_fix_common_vars PROTO((LPdata * lp_data, var_desc **vars, double *ip_sol, double *x));
115 
116 /* restricted search */
117 
118 int restricted_search PROTO((lp_prob *p, double *solution_value, double *colSolution,
119  double *betterSolution, int fr_mode, double t_lb));
120 
121 int fr_force_feasible(lp_prob *p, char use_base, int *sym_fixed_int_cnt, int *sym_fixed_c_cnt,
122  char *sym_fixed_type, double *sym_fixed_val, int *max_int_fix, int *max_c_fix);
123 
124 /* local branching */
125 int lbranching_search PROTO((lp_prob *p, double *solution_value, double *colSolution,
126  double *betterSolution, double t_lb));
127 
128 int resize_tmp1_arrays(LPdata *lp_data, int new_size);
129 
130 //sym_environment * lp_to_sym PROTO((lp_prob *p, LPdata *lp_data, char use_base));
131 sym_environment * lp_to_sym PROTO ((lp_prob *p, LPdata *lp_data, char use_base, int sym_fixed_cnt,
132  char *sym_fixed_type, double *sym_fixed_val,
133  double *sym_fixed_offset, int *unfix_nz, int *new_ind));
134 #endif
double * mip_obj
#define PROTO(x)
Definition: sym_proto.h:27
double ** x_bar_val
int fp_solve_lp(LPdata *lp_data, FPdata *fp_data, char *is_feasible)
struct FP_DATA FPdata
int fp_add_obj_row(LPdata *new_lp_data, int n, const double *obj, double rhs)
Definition: sym_tm.h:56
int fp_is_feasible(LPdata *lp_data, const CoinPackedMatrix *matrix, const double *r_low, const double *r_up, FPdata *fp_data, char *is_feasible)
int fp_round(lp_prob *p, FPdata *fp_data, LPdata *lp_data)
int fp_should_call_fp(lp_prob *p, int branching, int *should_call, char is_last_iter, double t_lb)
Sparse Matrix Base Class.
char * sos_var_fixed_zero
Definition: sym_lp.h:63
FPvars ** fp_vars
double flip_fraction
struct FP_VARS FPvars
double * alpha_p
int sp_free_sp(sp_desc *sp)
int resize_tmp1_arrays(LPdata *lp_data, int new_size)
int fp_fix_sos_var(lp_prob *p, FPdata *fp_data, int ind)
char * sos_row_filled
int feasibility_pump(lp_prob *p, char *found_better_solution, double &solution_value, double *colSolution, double *betterSolution)
int fp_can_sos_var_fix(lp_prob *p, FPdata *fp_data, int ind, int *filled_row_count)
int fp_initialize_lp_solver(lp_prob *p, LPdata *new_lp_data, FPdata *fp_data, double *colSolution)
int fr_force_feasible(lp_prob *p, char use_base, int *sym_fixed_int_cnt, int *sym_fixed_c_cnt, char *sym_fixed_type, double *sym_fixed_val, int *max_int_fix, int *max_c_fix)