problem formulation

Discussion in 'MATLAB' started by Michael Yampol, Nov 4, 2003.

  1. I don't think this problem is particularly well formulated, because :


    even if all entries in "a" are distinct,

    there is no solution if


    max(b) > sum(b)-max(b) + 1,


    i.e., when


    sum(b) < 2*max(b)- 1 ,


    and there is no instruction as to what to do in the case that the
    input renders the problem unsolvable.


    Furthermore, if the entries in "a" are not distinct, some entries
    which "passed" will actually FAIL.


    Example: a = [ 10 20 10 ]
    b = [ 2 3 2 ]


    Then this leading entry "j1"


    c = [];
    while sum(b)>0
    c=[c,a(b>0)]
    b=b-1
    end


    will give the INCORRECT result


    c = [ 10 20 10 10 20 10 20 ]


    when a correct result of


    [ 10 20 10 20 10 20 10 ] is feasible.


    If it is guaranteed that all entries in "a" are distinct, and that
    the values in "b" will not preclude a solution, this should be so
    specified in the problem formulation.
     
    Michael Yampol, Nov 4, 2003
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.