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?
python optimization scipy
add a comment |
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?
python optimization scipy
Show us type(A_ub)
– Richard Rublev
Nov 10 at 6:58
@RichardRublevtype(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
add a comment |
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?
python optimization scipy
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
python optimization scipy
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
@RichardRublevtype(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
add a comment |
Show us type(A_ub)
– Richard Rublev
Nov 10 at 6:58
@RichardRublevtype(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
add a comment |
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.
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 10 at 11:11
Richard Rublev
3,00641932
3,00641932
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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