[Symphony] Problems when "Num_rows" <= "Num_cols" in SYMPHONY
Menal Guzelsoy
megb at lehigh.edu
Wed Jan 20 03:42:06 EST 2010
Alberto,
There is no solution to report, since the problem is infeasible. I
would suggest you to check the solution status before querying the
solution.
Menal.
Menal Guzelsoy
1610 4620455
2010/1/19 Alberto Jorrín Rodríguez <albejor2002 at hotmail.com>:
> Hi,
>
>
>
> I am doing some tests with SYMPHONY and I am finding that when I have a
> problem where the number of constraints is lower than the number of unknown
> variables, I can not get the solution. For instance:
>
>
>
> In the next problem:
>
>
>
>
>
> minJ = 26.305*x1 + 26.0454*X2
>
>
>
> // Minimize
>
> // obj: 26.305*x1 + 26.0454*x2
>
> // Subject To
>
> // c1: 0.1531*x1 + 26.305*x2 <= -7.78666
>
> // Bounds
>
> // 0 <= x1 <= 1000000
>
> // 0 <= x2 <= 1000000
>
> // Integers
>
> // x1
>
>
>
>
>
> The code of the problem for SYMPHONY is:
>
>
>
>
>
> int main(int argc, char* argv[]){
>
>
>
> /* Create a SYMPHONY environment */
>
>
>
> sym_environment *env = sym_open_environment();
>
>
>
> int n_cols = 2; //number of columns
>
> double * objective =
>
> (double *) malloc(sizeof(double) * n_cols);//the objective
> coefficients
>
> double * col_lb =
>
> (double *) malloc(sizeof(double) * n_cols);//the column lower bounds
>
> double * col_ub =
>
> (double *) malloc(sizeof(double) * n_cols);//the column upper bounds
>
>
>
> //Define the objective coefficients.
>
>
>
> objective[0] = 26.305;
>
> objective[1] = 26.0454;
>
>
>
>
>
> //Define the variable lower/upper bounds.
>
> // --Bounds
>
> col_lb[0] = 0.0;
>
> col_lb[1] = 0.0;
>
>
>
> col_ub[0] = 1000000;
>
> col_ub[1] = 1000000;
>
>
>
>
>
>
>
> int n_rows = 1;
>
> char * row_sense =
>
> (char *) malloc (sizeof(char) * n_rows); //the row senses
>
> double * row_rhs =
>
> (double *) malloc (sizeof(double) * n_rows); //the row
> right-hand-sides
>
> double * row_range = NULL; //the row ranges
>
> row_sense[0] = 'L';
>
> row_rhs[0] = -7.78666;
>
>
>
>
>
>
>
> /* Constraint matrix definitions */
>
> int non_zeros = 2;
>
> int * start = (int *) malloc (sizeof(int) * (n_cols + 1));
>
> int * index = (int *) malloc (sizeof(int) * non_zeros);
>
> double * value = (double *) malloc (sizeof(double) *non_zeros);
>
>
>
>
>
> start[0] = 0;
>
> start[1] = 1;
>
> start[2] = 2;
>
>
>
> index[0] = 0;
>
> index[1] = 1;
>
>
>
> value[0] = 0.1531;
>
> value[1] = 26.305;
>
>
>
> //define the integer variables
>
>
>
> char * int_vars = (char *) malloc (sizeof(char) * n_cols);
>
>
>
> int_vars[0] = INTEGER;
>
> int_vars[1] = FALSE;
>
>
>
>
>
> //load the problem to environment
>
> sym_explicit_load_problem(env, n_cols, n_rows, start, index, value,
> col_lb,
>
> col_ub, int_vars, objective, NULL, row_sense,
>
> row_rhs, row_range, TRUE);
>
>
>
> //solve the integer program
>
> sym_solve(env);
>
>
>
> //get, print the solution
>
> double * solution = (double *) malloc (sizeof(double) * n_cols);
>
> double objective_value = 0.0;
>
>
>
> sym_get_col_solution(env, solution);
>
> sym_get_obj_val(env, &objective_value);
>
>
>
> printf("%s\n%s%f\n%s%f\n%s%f\n","JUEVES The optimal solution is",
>
> " x0 = ",solution[0],
>
> " x1 = ",solution[1],
>
> " with objective value = ",objective_value);
>
>
>
> //free the memory
>
> sym_close_environment(env);
>
>
>
> if(objective){free(objective);}
>
> if(col_lb) {free(col_lb);}
>
> if(col_ub) {free(col_ub);}
>
> if(row_rhs) {free(row_rhs);}
>
> if(row_sense){free(row_sense);}
>
> if(row_range){free(row_range);}
>
> if(index) {free(index);}
>
> if(start) {free(start);}
>
> if(value) {free(value);}
>
> if(int_vars) {free(int_vars);}
>
> if(solution) {free(solution);}
>
> return 0;
>
>
>
> }
>
>
>
>
>
>
>
> I get the next output:
>
>
>
> “Solving...
>
>
>
> Out of range 1 1 1 26.305
>
>
>
> ****************************************************
>
> * Branch and Cut Finished *
>
> * Now displaying stats and best solution found... *
>
> ****************************************************
>
>
>
> ====================== LP/CG Timing =========================
>
> Total Wallclock Time 0.000
>
>
>
> ====================== Statistics =========================
>
> Number of created nodes : 1
>
> Number of analyzed nodes: 1
>
> Depth of tree: 0
>
> Size of the tree: 1
>
> Number of solutions found: 0
>
> Number of solutions in pool: 0
>
> Number of Chains: 1
>
> Number of Diving Halts: 0
>
> Number of cuts in cut pool: 0
>
>
>
> ======================= LP Solver =========================
>
> Number of times LP solver called: 1
>
> Number of solutions found by LP solve: 0
>
>
>
> ==================== Feasibility Pump =====================
>
> Number of times feasibility pump called: 0
>
> Number of solutions found by feasibility pump: 0
>
> Time spent in feasibility pump: 0.00
>
>
>
> =========================== Cuts ==========================
>
> total cuts generated: 0
>
> total gomory cuts generated: 0
>
> total knapsack cuts generated: 0
>
> total oddhole cuts generated: 0
>
> total clique cuts generated: 0
>
> total probing cuts generated: 0
>
> total mir cuts generated: 0
>
> total twomir cuts generated: 0
>
> total flow and cover cuts generated: 0
>
> total rounding cuts generated: 0
>
> total lift and project cuts generated: 0
>
> total landp cuts generated: 0
>
>
>
> cuts removed because of bad coeffs: 0
>
> cuts removed because of duplicacy: 0
>
>
>
> cuts in root: 0
>
> gomory cuts in root: 0
>
> knapsack cuts in root: 0
>
> oddhole cuts in root: 0
>
> clique cuts in root: 0
>
> probing cuts in root: 0
>
> mir cuts in root: 0
>
> twomir cuts in root: 0
>
> flow and cover cuts in root: 0
>
> rounding cuts in root: 0
>
> lift and project cuts in root: 0
>
> landp cuts in root: 0
>
>
>
> time in cut generation: 0.00
>
> time in gomory cuts: 0.00
>
> time in knapsack cuts: 0.00
>
> time in oddhole cuts: 0.00
>
> time in clique cuts: 0.00
>
> time in probing cuts: 0.00
>
> time in mir cuts: 0.00
>
> time in twomir cuts: 0.00
>
> time in flow and cover cuts: 0.00
>
> time in rounding cuts: 0.00
>
> time in lift and project cuts: 0.00
>
> time in landp cuts: 0.00
>
> time in redsplit cuts: 0.00
>
> time in checking quality and adding: 0.00
>
>
>
> Current Lower Bound: 0.000
>
>
>
> The problem is infeasible!
>
> No Solution Found
>
>
>
> JUEVES The optimal solution is
>
> x0 = 0.000000
>
> x1 = 0.000000
>
> with objective value = 0.000000”
>
>
>
>
>
>
>
> What is my fault?
>
>
>
> Thanks a lot
>
>
>
> Regards
>
>
>
> ===========================================
>
> Alberto Jorrín Rodríguez
>
> Departamento de Ingenieria de Sistemas y Automatica
>
> Dpt. of Systems Engineering and Automatic Control
>
> Universidad de Valladolid / University of Valladolid
>
> Address: Facultad de Ciencias, c/ Real de Burgos s/n
>
> 47011 Valladolid, Spain
>
> Tel: +34 647 670 581, Fax: +34 983 423161
>
> e-mail: albejor at autom.uva.es
>
> ============================================
>
>
>
> ________________________________
> Llévate gratis un Mazda 2 y una Xbox 360. ¡Participa con Hotmail!
> _______________________________________________
> Symphony mailing list
> Symphony at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/symphony
>
>
More information about the Symphony
mailing list