Questions tagged [scipy-optimize-minimize]
446 questions
0
votes
2 answers
Solve parameter matrix with element-wise constraints using scipy optimize
I have a relatively simple optimisation problem, but am not particularly well-versed in scipy and cannot figure out how to apply the necessary constraints. My objective function is to minimise the absolute distance between a 10-element vector y and…

user3725021
- 566
- 3
- 14
- 32
0
votes
0 answers
Python: constrained optimization in python - fastest/efficient way?
I have a simple optimization problem in python which I need to re-run quite often (more than 10,000 times).
Most of the calculation can be done with numpy and the n-dimensional arrays quite efficient, however, when it comes to the optimization I am…

RubberDuckDebugging
- 57
- 5
0
votes
1 answer
SLSQP optimization not converging to unique solution
I am trying simple experiment to learn scipy's SLSQP optimizer.
I took the functions:
def obj(x):
return -1*((x[0]*x[0])+(x[1]*x[1]))
It's jacobian as :
def jacj(x):
return [-2*x[0],-2*x[1]]
It's bounds as:
bounds=[(0,1),(0,1)]
A simple…

ayush singhal
- 1,879
- 2
- 18
- 33
0
votes
0 answers
Optimizing using scipy with pandas data frame arguments
I am trying to optimize a function. But this function takes a pandas data frame as an argument. So when I run the code, I get this error:
TypeError: 'DataFrame' objects are mutable, thus they cannot be hashed
My evaluation function:
def…

Parth
- 2,682
- 1
- 20
- 39
0
votes
0 answers
How do I do a minimized chi-square for signal processing?
I am trying to wrap my head around the syntax for scipy.optimize.minimize. I have read the docs again and again and googled but I simply don't understand how to do this. Hope someone can point me in the right direction:
I have a signal (numpy array)…
0
votes
0 answers
Sci-Py Optimize Minimize function solution not respecting given bounds
As a simple web developer :) i'm having trouble figuring out a more data science focused problem when using SciPy Optimize minimize function. Given a set of bounds and a series of constraints i'm trying to find the values of 8 ingredients in this…

Andrew Heppner
- 41
- 1
- 6
0
votes
1 answer
Scipy minimisation optimisation row-wise on DataFrame
TYPO FIXEDD
I need to perform a minimization optimisation for each timestep in my timeseries. The optimisation sets the price based on values in different columns across the row and a series of inequality constraints.
My Dataframe has the following…

Brucey
- 3
- 2
0
votes
0 answers
SciPy Optimization for one and two variables
I'm writing this program where I have to do a bunch of optimizations. Some with only 1 variable, some with 2. At first I was using the basinhopping algorithm from the scipy.optimize library, but I figured that the normal minimize algorithm should do…

Frederik Vanclooster
- 443
- 1
- 7
- 21
0
votes
0 answers
.minimize function stuck after running program
I am creating a simple neural network that uses an image as it's input. It's all done except that I have to minimize my cost function, but when I run the scipy.optimize.minimize, it just sits there. I'd assume that it shouldn't take long as the…

Sandesh Ramesh
- 1
- 2
0
votes
1 answer
I have a function with 3 variables that I want to minimize the objective function
I have imported all the packages
def f(x,y,z):
return (1364*(z + x)**2 - (2728*(z + x)**3)/3 - 1600*y**2 + (3200*y**3)/3 \
- (5114092463576843*z**2)/4398046511104 + \
(5114092463576843*z**3)/6597069766656 +…

JPG_2019
- 3
- 1
0
votes
1 answer
How to use minimize from scipy correctly with multible variables?
I have five variables that I would like to subject to scipy.optimize.minimize in order to find the solution I am seeking in terms of A, B, C, D, and E. First, I imported minimize from scipy and defined the initial guesses (based on lab experiments,…

naughty_waves
- 265
- 1
- 13
0
votes
1 answer
Minimal example of multivariate minimization
so I'm trying to write a minimal working example of scipy.optimize.minimize with more than just one example.
Basically, my example works for a lambda-function of one variable but as soon as I add another one, It crashes.
lamX = lambda x:…

Spectral Confusion
- 13
- 3
0
votes
1 answer
TypeError with scipy.optimize when minimizing Cost func
I want to optimize 9 variables in W((1×9)matrix) by using scipy.optimize.
from scipy.optimize import minimize
def func(W):
W = W.reshape(1,9) #(1,9)
Y = df0.values.reshape(49,1) #(49,1)
X = df1.values.reshape(49,1) #(49,9)
Z =…

Higashi Yutaka
- 181
- 2
- 11
0
votes
0 answers
Termination conditions of scipy.optimize.minimize
I am using scipy library for an optimization problem.
My optimization code:
result = minimize(objective,x0,args=(a,b,c),method='nelder-mead',options={'xtol': 1e-8, 'disp': True})
I am using nelder-mead simplex solver as I am solving an…

chink
- 1,505
- 3
- 28
- 70
0
votes
0 answers
Parallel optimization for arguments in constraints with Python
I am trying to use scipy.optimize.minimze to minimize the objective function
as follows.
import numpy as np
from scipy import optimize
max_q_fun = lambda q : -q
def max_q_min(args):
cons = args
res =…

exteral
- 991
- 2
- 12
- 33