octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #40974] GLPK returns illegal solution


From: anonymous
Subject: [Octave-bug-tracker] [bug #40974] GLPK returns illegal solution
Date: Thu, 19 Dec 2013 19:33:11 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?40974>

                 Summary: GLPK returns illegal solution
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Thu 19 Dec 2013 07:33:11 PM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Inaccurate Result
                  Status: None
             Assigned to: None
         Originator Name: Niels Langager Ellegaard
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.4
        Operating System: GNU/Linux

    _______________________________________________________

Details:

The following line invokes glpk to solve an integer problem. But sadly GLPK
returns a solution that is not legal. If the solution was legal then A*x1
should be [0,0].

N=8; arow=10.^[0:N-1]-4*10.^[N-1:-1:0]; A=[arow;-arow];b=[0;0];c=[N-1:-1:0];
lb=zeros(1,N);ub=9*ones(1,N);[x1,x2,x3,x4]=glpk (c, A, b, lb, ub, "UU",
repmat("I",[1,N]), -1), A*x1
x1 =

   1
   9
   9
   9
   9
   9
   9
   7

x2 =  196.00
x3 =  171
x4 =

  scalar structure containing the fields:

    time = 0
    mem = 0

ans =

   3
  -3

If glpk has found an illegal solution, then the solver should probably warn he
user that the solution is illegal. Perhaps the wrapper could perform an extra
check to make sure that glpk is right.

Note: You can change the problem size by changing N. if you choose N=7, the
the code tuns nicely.

BTW: The code find numbers such as 2199978 that fullfills 

4*2199978 = 8799912 

IN other words you can reverse the ciphers by multiplying with 4.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?40974>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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