TypeError: Invalid input for linprog: A_ub must be a numerical 2D array with each row representing an upper bound inequality constraint









up vote
0
down vote

favorite












I'm doing linear optimization using interior point method.
My optimization code looks like



z=scipy.optimize.linprog(c, A_ub, b_ub, bounds=bounds,method='interior-point',
options = "maxiter":10000)


I have 34K of data. Checked the shape of A_ub using below code



A_ub.shape
Out[7]: (37439, 74878)


Initially same code ran for 8K data but now it's throwing error



TypeError: Invalid input for linprog: A_ub must be a numerical 2D array with each row representing an upper bound inequality constraint


Can you help me to resolve this issue?










share|improve this question























  • Show us type(A_ub)
    – Richard Rublev
    Nov 10 at 6:58










  • @RichardRublev type(A_ub) Out[11]: numpy.ndarray
    – Jesmin
    Nov 10 at 8:55






  • 1




    This is not enough information (and we can't run that code). My best guess (having hacked on that code in the past): your memory blows up and the design of this functions exception-handling effects in this message (which is misleading). With code available, you can learn from this part of the sources.
    – sascha
    Nov 10 at 11:09















up vote
0
down vote

favorite












I'm doing linear optimization using interior point method.
My optimization code looks like



z=scipy.optimize.linprog(c, A_ub, b_ub, bounds=bounds,method='interior-point',
options = "maxiter":10000)


I have 34K of data. Checked the shape of A_ub using below code



A_ub.shape
Out[7]: (37439, 74878)


Initially same code ran for 8K data but now it's throwing error



TypeError: Invalid input for linprog: A_ub must be a numerical 2D array with each row representing an upper bound inequality constraint


Can you help me to resolve this issue?










share|improve this question























  • Show us type(A_ub)
    – Richard Rublev
    Nov 10 at 6:58










  • @RichardRublev type(A_ub) Out[11]: numpy.ndarray
    – Jesmin
    Nov 10 at 8:55






  • 1




    This is not enough information (and we can't run that code). My best guess (having hacked on that code in the past): your memory blows up and the design of this functions exception-handling effects in this message (which is misleading). With code available, you can learn from this part of the sources.
    – sascha
    Nov 10 at 11:09













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm doing linear optimization using interior point method.
My optimization code looks like



z=scipy.optimize.linprog(c, A_ub, b_ub, bounds=bounds,method='interior-point',
options = "maxiter":10000)


I have 34K of data. Checked the shape of A_ub using below code



A_ub.shape
Out[7]: (37439, 74878)


Initially same code ran for 8K data but now it's throwing error



TypeError: Invalid input for linprog: A_ub must be a numerical 2D array with each row representing an upper bound inequality constraint


Can you help me to resolve this issue?










share|improve this question















I'm doing linear optimization using interior point method.
My optimization code looks like



z=scipy.optimize.linprog(c, A_ub, b_ub, bounds=bounds,method='interior-point',
options = "maxiter":10000)


I have 34K of data. Checked the shape of A_ub using below code



A_ub.shape
Out[7]: (37439, 74878)


Initially same code ran for 8K data but now it's throwing error



TypeError: Invalid input for linprog: A_ub must be a numerical 2D array with each row representing an upper bound inequality constraint


Can you help me to resolve this issue?







python optimization scipy






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 11:16









sascha

17.6k53166




17.6k53166










asked Nov 10 at 6:55









Jesmin

166




166











  • Show us type(A_ub)
    – Richard Rublev
    Nov 10 at 6:58










  • @RichardRublev type(A_ub) Out[11]: numpy.ndarray
    – Jesmin
    Nov 10 at 8:55






  • 1




    This is not enough information (and we can't run that code). My best guess (having hacked on that code in the past): your memory blows up and the design of this functions exception-handling effects in this message (which is misleading). With code available, you can learn from this part of the sources.
    – sascha
    Nov 10 at 11:09

















  • Show us type(A_ub)
    – Richard Rublev
    Nov 10 at 6:58










  • @RichardRublev type(A_ub) Out[11]: numpy.ndarray
    – Jesmin
    Nov 10 at 8:55






  • 1




    This is not enough information (and we can't run that code). My best guess (having hacked on that code in the past): your memory blows up and the design of this functions exception-handling effects in this message (which is misleading). With code available, you can learn from this part of the sources.
    – sascha
    Nov 10 at 11:09
















Show us type(A_ub)
– Richard Rublev
Nov 10 at 6:58




Show us type(A_ub)
– Richard Rublev
Nov 10 at 6:58












@RichardRublev type(A_ub) Out[11]: numpy.ndarray
– Jesmin
Nov 10 at 8:55




@RichardRublev type(A_ub) Out[11]: numpy.ndarray
– Jesmin
Nov 10 at 8:55




1




1




This is not enough information (and we can't run that code). My best guess (having hacked on that code in the past): your memory blows up and the design of this functions exception-handling effects in this message (which is misleading). With code available, you can learn from this part of the sources.
– sascha
Nov 10 at 11:09





This is not enough information (and we can't run that code). My best guess (having hacked on that code in the past): your memory blows up and the design of this functions exception-handling effects in this message (which is misleading). With code available, you can learn from this part of the sources.
– sascha
Nov 10 at 11:09













1 Answer
1






active

oldest

votes

















up vote
-1
down vote













I found this example from old code



from scipy import optimize
optimize.linprog(
... c = [1, 3],
... A_ub=[[1, 1]],
... b_ub=[4],
... bounds=(1, 6),
... method='interior-point'
... )
con: array(, dtype=float64)
fun: 4.00000000831602
message: 'Optimization terminated successfully.'
nit: 4
slack: array([2.])
status: 0
success: True
x: array([1., 1.])


Of course you can use simple or any other method. May be you should check memory,you are dealing with large arrays.






share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236708%2ftypeerror-invalid-input-for-linprog-a-ub-must-be-a-numerical-2d-array-with-eac%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    -1
    down vote













    I found this example from old code



    from scipy import optimize
    optimize.linprog(
    ... c = [1, 3],
    ... A_ub=[[1, 1]],
    ... b_ub=[4],
    ... bounds=(1, 6),
    ... method='interior-point'
    ... )
    con: array(, dtype=float64)
    fun: 4.00000000831602
    message: 'Optimization terminated successfully.'
    nit: 4
    slack: array([2.])
    status: 0
    success: True
    x: array([1., 1.])


    Of course you can use simple or any other method. May be you should check memory,you are dealing with large arrays.






    share|improve this answer
























      up vote
      -1
      down vote













      I found this example from old code



      from scipy import optimize
      optimize.linprog(
      ... c = [1, 3],
      ... A_ub=[[1, 1]],
      ... b_ub=[4],
      ... bounds=(1, 6),
      ... method='interior-point'
      ... )
      con: array(, dtype=float64)
      fun: 4.00000000831602
      message: 'Optimization terminated successfully.'
      nit: 4
      slack: array([2.])
      status: 0
      success: True
      x: array([1., 1.])


      Of course you can use simple or any other method. May be you should check memory,you are dealing with large arrays.






      share|improve this answer






















        up vote
        -1
        down vote










        up vote
        -1
        down vote









        I found this example from old code



        from scipy import optimize
        optimize.linprog(
        ... c = [1, 3],
        ... A_ub=[[1, 1]],
        ... b_ub=[4],
        ... bounds=(1, 6),
        ... method='interior-point'
        ... )
        con: array(, dtype=float64)
        fun: 4.00000000831602
        message: 'Optimization terminated successfully.'
        nit: 4
        slack: array([2.])
        status: 0
        success: True
        x: array([1., 1.])


        Of course you can use simple or any other method. May be you should check memory,you are dealing with large arrays.






        share|improve this answer












        I found this example from old code



        from scipy import optimize
        optimize.linprog(
        ... c = [1, 3],
        ... A_ub=[[1, 1]],
        ... b_ub=[4],
        ... bounds=(1, 6),
        ... method='interior-point'
        ... )
        con: array(, dtype=float64)
        fun: 4.00000000831602
        message: 'Optimization terminated successfully.'
        nit: 4
        slack: array([2.])
        status: 0
        success: True
        x: array([1., 1.])


        Of course you can use simple or any other method. May be you should check memory,you are dealing with large arrays.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 10 at 11:11









        Richard Rublev

        3,00641932




        3,00641932



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236708%2ftypeerror-invalid-input-for-linprog-a-ub-must-be-a-numerical-2d-array-with-eac%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kleinkühnau

            Makov (Slowakei)

            Deutsches Schauspielhaus