help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] dual result problem


From: cen zhihao
Subject: [Help-glpk] dual result problem
Date: Tue, 31 Mar 2009 21:52:09 +0300

I have a question of dual result : the one by glpsol and the one by glp_simplex 
are not the same.


code c++ : 

glp_prob* probCopy= glp_create_prob();

glp_copy_prob(probCopy, xxxxxx, GLP_OFF);

glp_simplex(probCopy, xxxxxx);

glp_write_lp(probCopy, NULL, "prob.lp");

lpx_print_sol(probCopy, "result_simplex.txt");




and 

        glpsol --cpxlp prob.lp -o result_glpsol.txt.




Thanks in advance.




And here are the different results




===================="result_glpsol.txt"======================




Problem:    

Rows:       19

Columns:    40

Non-zeros:  116

Status:     OPTIMAL

Objective:  obj = 3.135276971 (MINimum)




   No.   Row name   St   Activity     Lower bound   Upper bound    Marginal

------ ------------ -- ------------- ------------- ------------- -------------

     1 r_1          NS            48            48             =     -0.698933

     2 r_2          NS          22.4          22.4             =     -0.668988

     3 r_3          NS          98.8          98.8             =     -0.365573

     4 r_4          NS          12.8          12.8             =       1.25434

     5 r_5          B          14.45         14.45             = 

     6 r_6          B          31.71         31.71             = 

     7 r_7          B             68         -36.6               

     8 r_8          B              0             0               

     9 r_9          B              0             0               

    10 r_10         B          14.63             0               

    11 r.30         NU         14.63                       14.63     -0.113469

    12 r_11         B           7.97             0               

    13 r.32         NU          7.97                        7.97      -2.19142

    14 r_12         B          32.44             0               

    15 r.34         B          32.44                      1e+020 

    16 r_13         B          19.04             0               

    17 r_14         NL            36            36                    0.764259

    18 r.39         B             36                          50 

    19 r_15         B            3.2           3.2               




   No. Column name  St   Activity     Lower bound   Upper bound    Marginal

------ ------------ -- ------------- ------------- ------------- -------------

     1 x_1          NL             0             0                    0.893658

     2 x_2          NL             0             0                   0.0875705

     3 x_3          NL             0             0                    0.666719

     4 x_4          NL             0             0                     2.55399

     5 x_5          NL             0             0                    0.833768

     6 x_6          B            3.2             0               

     7 x_7          NL             0             0                    0.606829

     8 x_8          NL             0             0                    0.226939

     9 x_9          B            3.2             0               

    10 x_10         NL             0             0                    0.211116

    11 x_11         NL             0             0                    0.626995

    12 x_12         NL             0             0                       < eps

    13 x_13         NL             0             0                     3.10799

    14 x_14         NL             0             0                       2.481

    15 x_15         NL             0             0                    0.626995

    16 x_16         B              0             0               

    17 x_17         NL             0             0                    0.626995

    18 x_18         NL             0             0                       < eps

    19 x_19         NL             0             0                    0.626995

    20 x_20         B              0             0               

    21 x_21         NL             0             0                    0.626995

    22 x_22         B              0             0               

    23 x_23         NL             0             0                    0.626995

    24 x_24         B              0             0               

    25 x_25         NL             0             0                    0.626995

    26 x_26         B            6.1             0               

    27 x_27         NS            48            48             =      0.698933

    28 x_28         NS          19.2          19.2             =      0.668988

    29 x_29         NS          89.5          89.5             =      0.365573

    30 x_30         NS           9.6           9.6             =      -1.25434

    31 x_31         NS         14.45         14.45             =         < eps

    32 x_32         NS         28.51         28.51             =         < eps

    33 x_33         NS          64.8          64.8             =         < eps

    34 x_34         NS             0             0             =         < eps

    35 x_35         NS             0             0             =         < eps

    36 x_36         NS         14.63         14.63             =      0.113469

    37 x_37         NS          7.97          7.97             =       2.19142

    38 x_38         NS         26.34         26.34             =         < eps

    39 x_39         NS         19.04         19.04             =         < eps

    40 x_40         NS          29.9          29.9             =     -0.764259




Karush-Kuhn-Tucker optimality conditions:




KKT.PE: max.abs.err. = 1.42e-014 on row 7

        max.rel.err. = 2.06e-016 on row 7

        High quality




KKT.PB: max.abs.err. = 4.44e-015 on row 19

        max.rel.err. = 1.06e-015 on row 19

        High quality




KKT.DE: max.abs.err. = 3.33e-016 on column 14

        max.rel.err. = 1.31e-016 on column 4

        High quality




KKT.DB: max.abs.err. = 0.00e+000 on row 0

        max.rel.err. = 0.00e+000 on row 0

        High quality




End of output




================="result_simplex.txt"==================



Problem:    

Rows:       16

Columns:    40

Non-zeros:  88

Status:     OPTIMAL

Objective:  3.135276971 (MINimum)




   No.   Row name   St   Activity     Lower bound   Upper bound    Marginal

------ ------------ -- ------------- ------------- ------------- -------------

     1              NS            48            48             =      -2.80279

     2              NS          22.4          22.4             =      -1.60607

     3              NS          98.8          98.8             =     -0.365573

     4              B           12.8          12.8             = 

     5              B          14.45         14.45             = 

     6              NS         31.71         31.71             =       2.19142

     7              B             68         -36.6               

     8              B              0             0               

     9              B              0             0               

    10              NU         14.63             0         14.63     -0.113469

    11              B           7.97             0          7.97 

    12              B          32.44             0         1e+20 

    13              B          19.04             0               

    14              NL            36            36            50      0.764259

    15              B            3.2           3.2               

    16              B              0                             




   No. Column name  St   Activity     Lower bound   Upper bound    Marginal

------ ------------ -- ------------- ------------- ------------- -------------

     1              NL             0             0                     2.99751

     2              B              0             0               

     3              NL             0             0                     2.77057

     4              NL             0             0                     4.65784

     5              NL             0             0                     1.77085

     6              B            3.2             0               

     7              NL             0             0                     1.54391

     8              NL             0             0                    0.226939

     9              B            3.2             0               

    10              NL             0             0                    0.211116

    11              NL             0             0                     2.73085

    12              NL             0             0                     2.10385

    13              NL             0             0                     3.02042

    14              NL             0             0                     2.39343

    15              NL             0             0                     2.73085

    16              NL             0             0                     2.10385

    17              NL             0             0                     1.56408

    18              NL             0             0                    0.937085

    19              NL             0             0                    0.626995

    20              B              0             0               

    21              NL             0             0                     1.56408

    22              NL             0             0                    0.937085

    23              NL             0             0                    0.626995

    24              B              0             0               

    25              NL             0             0                    0.626995

    26              B            6.1             0               

    27              NS            48            48             =       2.80279

    28              NS          19.2          19.2             =       1.60607

    29              NS          89.5          89.5             =      0.365573

    30              NS           9.6           9.6             =         < eps

    31              NS         14.45         14.45             =         < eps

    32              NS         28.51         28.51             =      -2.19142

    33              NS          64.8          64.8             =         < eps

    34              NS             0             0             =         < eps

    35              NS             0             0             =         < eps

    36              NS         14.63         14.63             =      0.113469

    37              NS          7.97          7.97             =         < eps

    38              NS         26.34         26.34             =         < eps

    39              NS         19.04         19.04             =         < eps

    40              NS          29.9          29.9             =     -0.764259




Karush-Kuhn-Tucker optimality conditions:




KKT.PE: max.abs.err. = 7.11e-15 on row 7

        max.rel.err. = 1.06e-16 on row 12

        High quality




KKT.PB: max.abs.err. = 4.44e-15 on row 15

        max.rel.err. = 1.06e-15 on row 15

        High quality




KKT.DE: max.abs.err. = 8.88e-16 on column 4

        max.rel.err. = 2.34e-16 on column 4

        High quality




KKT.DB: max.abs.err. = 0.00e+00 on row 0

        max.rel.err. = 0.00e+00 on row 0

        High quality




End of output




================="prob.lp"====================

\* Problem: Unknown *\




Minimize

 obj: + 0.194725365844387 x_1 - 0.611362153117218 x_2

 - 0.0322134773543005 x_3 + 1.85505584946619 x_4 + 0.16478029267551 x_5

 + 0.585352152962554 x_6 - 0.062158550523178 x_7 - 0.138634202092711 x_8

 - 0.365573045291399 x_9 - 0.154457366081977 x_10

 - 0.185407046010089 x_11 - 0.04814311635353 x_12

 + 0.217636713470713 x_13 + 0.354900643127272 x_14

 - 0.0719376244107455 x_15 + 0.0653263052458138 x_16

 - 0.155461972841212 x_17 - 0.0181980431846525 x_18

 - 0.979077592609059 x_19 - 0.841813662952499 x_20

 - 0.041992551241868 x_21 + 0.0952713784146914 x_22

 + 0.147952521927009 x_23 + 0.285216451583569 x_24

 + 0.261421943526353 x_25 + 0.398685873182913 x_26




Subject To

 r_1: + x_27 + x_16 + x_15 + x_14 + x_13 + x_12 + x_11 + x_4 + x_3 + x_2

 + x_1 = 48

 r_2: + x_28 + x_22 + x_21 + x_20 + x_19 + x_18 + x_17 + x_7 + x_6 + x_5

 = 22.4

 r_3: + x_29 + x_26 + x_25 + x_24 + x_23 + x_10 + x_9 + x_8 = 98.8

 r_4: + x_30 + x_20 + x_19 + x_6 = 12.8

 r_5: + x_31 + x_8 + x_5 + x_1 = 14.45

 r_6: + x_32 + x_6 + x_2 = 31.71

 r_7: + x_33 + x_9 + x_7 + x_3>= -36.6

 r_8: + x_34 + x_4>= 0

 r_9: + x_35 + x_10>= 0

 r_10: + x_36 + x_24 + x_23 + x_18 + x_17 + x_12 + x_11>= 0

       + x_36 + x_24 + x_23 + x_18 + x_17 + x_12 + x_11 <= 14.63

 r_11: + x_37 + x_20 + x_19 + x_14 + x_13>= 0

       + x_37 + x_20 + x_19 + x_14 + x_13 <= 7.97

 r_12: + x_38 + x_26 + x_25 + x_22 + x_21 + x_16 + x_15>= 0

       + x_38 + x_26 + x_25 + x_22 + x_21 + x_16 + x_15 <= 1e+20

 r_13: + x_39 + x_25 + x_23 + x_21 + x_19 + x_17 + x_15 + x_13 + x_11

 >= 0

 r_14: + x_40 + x_26 + x_24 + x_22 + x_20 + x_18 + x_16 + x_14 + x_12

 >= 36

       + x_40 + x_26 + x_24 + x_22 + x_20 + x_18 + x_16 + x_14 + x_12

 <= 50

 r_15: + x_9 + x_7 + x_3>= 3.2




Bounds

 x_27 = 48

 x_28 = 19.2

 x_29 = 89.5

 x_30 = 9.6

 x_31 = 14.45

 x_32 = 28.51

 x_33 = 64.8

 x_34 = 0

 x_35 = 0

 x_36 = 14.63

 x_37 = 7.97

 x_38 = 26.34

 x_39 = 19.04

 x_40 = 29.9




End















Souhaitez vous  « кtre au bureau sans y кtre » ? Oui je le veux !
I have a question of dual result : the one by glpsol and the one by glp_simplex are not the same.

code c++ : 
glp_prob* probCopy= glp_create_prob();
glp_copy_prob(probCopy, xxxxxx, GLP_OFF);
glp_simplex(probCopy, xxxxxx);
glp_write_lp(probCopy, NULL, "prob.lp");
lpx_print_sol(probCopy, "result_simplex.txt");

and 
        glpsol --cpxlp prob.lp -o result_glpsol.txt.

Thanks in advance.

And here are the different results

===================="result_glpsol.txt"======================

Problem:    
Rows:       19
Columns:    40
Non-zeros:  116
Status:     OPTIMAL
Objective:  obj = 3.135276971 (MINimum)

   No.   Row name   St   Activity     Lower bound   Upper bound    Marginal
------ ------------ -- ------------- ------------- ------------- -------------
     1 r_1          NS            48            48             =     -0.698933
     2 r_2          NS          22.4          22.4             =     -0.668988
     3 r_3          NS          98.8          98.8             =     -0.365573
     4 r_4          NS          12.8          12.8             =       1.25434
     5 r_5          B          14.45         14.45             = 
     6 r_6          B          31.71         31.71             = 
     7 r_7          B             68         -36.6               
     8 r_8          B              0             0               
     9 r_9          B              0             0               
    10 r_10         B          14.63             0               
    11 r.30         NU         14.63                       14.63     -0.113469
    12 r_11         B           7.97             0               
    13 r.32         NU          7.97                        7.97      -2.19142
    14 r_12         B          32.44             0               
    15 r.34         B          32.44                      1e+020 
    16 r_13         B          19.04             0               
    17 r_14         NL            36            36                    0.764259
    18 r.39         B             36                          50 
    19 r_15         B            3.2           3.2               

   No. Column name  St   Activity     Lower bound   Upper bound    Marginal
------ ------------ -- ------------- ------------- ------------- -------------
     1 x_1          NL             0             0                    0.893658
     2 x_2          NL             0             0                   0.0875705
     3 x_3          NL             0             0                    0.666719
     4 x_4          NL             0             0                     2.55399
     5 x_5          NL             0             0                    0.833768
     6 x_6          B            3.2             0               
     7 x_7          NL             0             0                    0.606829
     8 x_8          NL             0             0                    0.226939
     9 x_9          B            3.2             0               
    10 x_10         NL             0             0                    0.211116
    11 x_11         NL             0             0                    0.626995
    12 x_12         NL             0             0                       < eps
    13 x_13         NL             0             0                     3.10799
    14 x_14         NL             0             0                       2.481
    15 x_15         NL             0             0                    0.626995
    16 x_16         B              0             0               
    17 x_17         NL             0             0                    0.626995
    18 x_18         NL             0             0                       < eps
    19 x_19         NL             0             0                    0.626995
    20 x_20         B              0             0               
    21 x_21         NL             0             0                    0.626995
    22 x_22         B              0             0               
    23 x_23         NL             0             0                    0.626995
    24 x_24         B              0             0               
    25 x_25         NL             0             0                    0.626995
    26 x_26         B            6.1             0               
    27 x_27         NS            48            48             =      0.698933
    28 x_28         NS          19.2          19.2             =      0.668988
    29 x_29         NS          89.5          89.5             =      0.365573
    30 x_30         NS           9.6           9.6             =      -1.25434
    31 x_31         NS         14.45         14.45             =         < eps
    32 x_32         NS         28.51         28.51             =         < eps
    33 x_33         NS          64.8          64.8             =         < eps
    34 x_34         NS             0             0             =         < eps
    35 x_35         NS             0             0             =         < eps
    36 x_36         NS         14.63         14.63             =      0.113469
    37 x_37         NS          7.97          7.97             =       2.19142
    38 x_38         NS         26.34         26.34             =         < eps
    39 x_39         NS         19.04         19.04             =         < eps
    40 x_40         NS          29.9          29.9             =     -0.764259

Karush-Kuhn-Tucker optimality conditions:

KKT.PE: max.abs.err. = 1.42e-014 on row 7
        max.rel.err. = 2.06e-016 on row 7
        High quality

KKT.PB: max.abs.err. = 4.44e-015 on row 19
        max.rel.err. = 1.06e-015 on row 19
        High quality

KKT.DE: max.abs.err. = 3.33e-016 on column 14
        max.rel.err. = 1.31e-016 on column 4
        High quality

KKT.DB: max.abs.err. = 0.00e+000 on row 0
        max.rel.err. = 0.00e+000 on row 0
        High quality

End of output

================="result_simplex.txt"==================
Problem:    
Rows:       16
Columns:    40
Non-zeros:  88
Status:     OPTIMAL
Objective:  3.135276971 (MINimum)

   No.   Row name   St   Activity     Lower bound   Upper bound    Marginal
------ ------------ -- ------------- ------------- ------------- -------------
     1              NS            48            48             =      -2.80279
     2              NS          22.4          22.4             =      -1.60607
     3              NS          98.8          98.8             =     -0.365573
     4              B           12.8          12.8             = 
     5              B          14.45         14.45             = 
     6              NS         31.71         31.71             =       2.19142
     7              B             68         -36.6               
     8              B              0             0               
     9              B              0             0               
    10              NU         14.63             0         14.63     -0.113469
    11              B           7.97             0          7.97 
    12              B          32.44             0         1e+20 
    13              B          19.04             0               
    14              NL            36            36            50      0.764259
    15              B            3.2           3.2               
    16              B              0                             

   No. Column name  St   Activity     Lower bound   Upper bound    Marginal
------ ------------ -- ------------- ------------- ------------- -------------
     1              NL             0             0                     2.99751
     2              B              0             0               
     3              NL             0             0                     2.77057
     4              NL             0             0                     4.65784
     5              NL             0             0                     1.77085
     6              B            3.2             0               
     7              NL             0             0                     1.54391
     8              NL             0             0                    0.226939
     9              B            3.2             0               
    10              NL             0             0                    0.211116
    11              NL             0             0                     2.73085
    12              NL             0             0                     2.10385
    13              NL             0             0                     3.02042
    14              NL             0             0                     2.39343
    15              NL             0             0                     2.73085
    16              NL             0             0                     2.10385
    17              NL             0             0                     1.56408
    18              NL             0             0                    0.937085
    19              NL             0             0                    0.626995
    20              B              0             0               
    21              NL             0             0                     1.56408
    22              NL             0             0                    0.937085
    23              NL             0             0                    0.626995
    24              B              0             0               
    25              NL             0             0                    0.626995
    26              B            6.1             0               
    27              NS            48            48             =       2.80279
    28              NS          19.2          19.2             =       1.60607
    29              NS          89.5          89.5             =      0.365573
    30              NS           9.6           9.6             =         < eps
    31              NS         14.45         14.45             =         < eps
    32              NS         28.51         28.51             =      -2.19142
    33              NS          64.8          64.8             =         < eps
    34              NS             0             0             =         < eps
    35              NS             0             0             =         < eps
    36              NS         14.63         14.63             =      0.113469
    37              NS          7.97          7.97             =         < eps
    38              NS         26.34         26.34             =         < eps
    39              NS         19.04         19.04             =         < eps
    40              NS          29.9          29.9             =     -0.764259

Karush-Kuhn-Tucker optimality conditions:

KKT.PE: max.abs.err. = 7.11e-15 on row 7
        max.rel.err. = 1.06e-16 on row 12
        High quality

KKT.PB: max.abs.err. = 4.44e-15 on row 15
        max.rel.err. = 1.06e-15 on row 15
        High quality

KKT.DE: max.abs.err. = 8.88e-16 on column 4
        max.rel.err. = 2.34e-16 on column 4
        High quality

KKT.DB: max.abs.err. = 0.00e+00 on row 0
        max.rel.err. = 0.00e+00 on row 0
        High quality

End of output

================="prob.lp"====================
\* Problem: Unknown *\

Minimize
 obj: + 0.194725365844387 x_1 - 0.611362153117218 x_2
 - 0.0322134773543005 x_3 + 1.85505584946619 x_4 + 0.16478029267551 x_5
 + 0.585352152962554 x_6 - 0.062158550523178 x_7 - 0.138634202092711 x_8
 - 0.365573045291399 x_9 - 0.154457366081977 x_10
 - 0.185407046010089 x_11 - 0.04814311635353 x_12
 + 0.217636713470713 x_13 + 0.354900643127272 x_14
 - 0.0719376244107455 x_15 + 0.0653263052458138 x_16
 - 0.155461972841212 x_17 - 0.0181980431846525 x_18
 - 0.979077592609059 x_19 - 0.841813662952499 x_20
 - 0.041992551241868 x_21 + 0.0952713784146914 x_22
 + 0.147952521927009 x_23 + 0.285216451583569 x_24
 + 0.261421943526353 x_25 + 0.398685873182913 x_26

Subject To
 r_1: + x_27 + x_16 + x_15 + x_14 + x_13 + x_12 + x_11 + x_4 + x_3 + x_2
 + x_1 = 48
 r_2: + x_28 + x_22 + x_21 + x_20 + x_19 + x_18 + x_17 + x_7 + x_6 + x_5
 = 22.4
 r_3: + x_29 + x_26 + x_25 + x_24 + x_23 + x_10 + x_9 + x_8 = 98.8
 r_4: + x_30 + x_20 + x_19 + x_6 = 12.8
 r_5: + x_31 + x_8 + x_5 + x_1 = 14.45
 r_6: + x_32 + x_6 + x_2 = 31.71
 r_7: + x_33 + x_9 + x_7 + x_3>= -36.6
 r_8: + x_34 + x_4>= 0
 r_9: + x_35 + x_10>= 0
 r_10: + x_36 + x_24 + x_23 + x_18 + x_17 + x_12 + x_11>= 0
       + x_36 + x_24 + x_23 + x_18 + x_17 + x_12 + x_11 <= 14.63
 r_11: + x_37 + x_20 + x_19 + x_14 + x_13>= 0
       + x_37 + x_20 + x_19 + x_14 + x_13 <= 7.97
 r_12: + x_38 + x_26 + x_25 + x_22 + x_21 + x_16 + x_15>= 0
       + x_38 + x_26 + x_25 + x_22 + x_21 + x_16 + x_15 <= 1e+20
 r_13: + x_39 + x_25 + x_23 + x_21 + x_19 + x_17 + x_15 + x_13 + x_11
 >= 0
 r_14: + x_40 + x_26 + x_24 + x_22 + x_20 + x_18 + x_16 + x_14 + x_12
 >= 36
       + x_40 + x_26 + x_24 + x_22 + x_20 + x_18 + x_16 + x_14 + x_12
 <= 50
 r_15: + x_9 + x_7 + x_3>= 3.2

Bounds
 x_27 = 48
 x_28 = 19.2
 x_29 = 89.5
 x_30 = 9.6
 x_31 = 14.45
 x_32 = 28.51
 x_33 = 64.8
 x_34 = 0
 x_35 = 0
 x_36 = 14.63
 x_37 = 7.97
 x_38 = 26.34
 x_39 = 19.04
 x_40 = 29.9

End



Souhaitez vous  « être au bureau sans y être » ? Oui je le veux !

reply via email to

[Prev in Thread] Current Thread [Next in Thread]