Questions tagged [scipy-optimize-minimize]
446 questions
0
votes
1 answer
Optimize non-scalar function with inequality constraint and bounds
I am looking for an optimization method in scipy which allows me to minimize object function f(x,y) (returns vector) subject to the constraint g(x,y) < 0.1 and additional bounds on x and y.
I have tried to solve my problem with…

Simon
- 3
- 1
0
votes
0 answers
Can't construct constraints (of scipy.optimize.minimize) with append
To resolve a quadratic minimum problem I used scipy.Optimize.Minimize.
First I initialize my function and some points :
def func(x):
return 1/4*(x[0]**2+x[1]**2) + x[2]
P1=[]
for i in range(3):
P1.append((rd.uniform(-1,1),…

Raphael Monin
- 13
- 2
0
votes
2 answers
basinhopping_bounds() got an unexpected keyword argument 'f_new'
I'm getting this error when using basin-hopping:
basinhopping_bounds() got an unexpected keyword argument 'f_new'
I'm trying to implement the analysis of X,F models in Python to solving a DTLZ7 problem.
So, I've started with a problem with 4 linear…

Felipe Ramalho
- 47
- 5
0
votes
1 answer
A problem with optimization of function that contains loops
I have a problem with optimizing of a function that contains loops.
I start with paricular lista=[0.002,0.006,0.003,0.02,0.008,0.006,0.05]
of floats and the intervals `(0,k*0.0025),(0.005,k*0.005),(0.005,k*0.0125), where upper border depends. So,…

Neo R.
- 9
- 3
0
votes
1 answer
callback function throws a error in scipy.optimize.minimize class
I am using scipy.minimize for an optimization problem.
This is my code
import numpy as np
from scipy.optimize import minimize
from scipy.optimize import Bounds
#bounds = Bounds([25, 36], [26,…

chink
- 1,505
- 3
- 28
- 70
0
votes
1 answer
ctypes array is not callable
I want to use the scipy.optimize.minimize function. The function contains commands from a DLL which require a ctypes array. The goal is to vary the inputs in the ctypes array to optimize a specific output which is also a ctypes array (see code…
user11367503
0
votes
1 answer
Undefined name error when minimizing using scipy
I am trying to minimize a function using scipy.optimize.minimize(). Below is the piece of code which I am trying to execute.
When I execute the same I am getting
NameError: name 'j' is not defined
import numpy as np
import pandas as pd
import…

Jithesh Erancheri
- 281
- 1
- 5
- 14
0
votes
1 answer
'ValueError: could not broadcast input array from shape (5,5) into shape (5)' for scipy.optimize-minimize
I have a function y(T,x,p). I have the data for T,p,x,y. With this data i want to know the coefficients so I can use the function to get any y I want to. So far I have this with using scipy.optimize.minimize and method='cobyla':
import numpy as…

Jack.O.
- 171
- 1
- 14
0
votes
0 answers
scipy.optimize problem with matrix operations
I am trying to minimize a simple GMM criterion, calling variables from a Pandas dataframe. Each column name present a column in the dataframe (492 observations). In the first block I define matrices and vector from the dataframe, in the second part…

iiiccciii
- 1
- 1
0
votes
0 answers
scipy.optimize minimize not changing value. think it's due to late binding but unsure how to change...
I'm fairly new to this but will try and be as clear as possible.
Essentially I have 5 different lists of lists. 4 are imported from txt files and the 5th is a merger of the 4. Each inner list contains a value at index position 3. My objective is to…

tyu0912
- 11
- 4
0
votes
1 answer
How to convert symbol variable to iterable variable?
I am trying to minimize a function using scipy.optimize. Here is my programme and the last line is the error message.
import sympy as s
from scipy.optimize import minimize
x,y,z=s.symbols('x y z')
f= lambda z: x**2-y**2
bnds = ((70,None),(4,6))
res…

Shareef
- 11
- 5
0
votes
0 answers
optimization with python scipy.optimize failed in converting 8th argument `g'
I am trying to maximize the function below using Python's scipy.optimize.minimize(it is a way to get the diversified portfolio called maximimum diversification). However, there are always some problem.
The objective function:
max f =…

Y.cady
- 21
- 1
- 3
-1
votes
1 answer
in scipy.optimize.minimize - could not be broadcast together data with shapes (2,) (2,5)
I cannot cope with shapes mismatch in scipy.optimize.minimize here in this example:
import numpy as np
from scipy.spatial import distance_matrix
from scipy.optimize import minimize
# Create the matrices
X = np.array([[1,2,3,4,5],[2,1,0,3,4]])
y =…

JeeyCi
- 354
- 2
- 9
-1
votes
1 answer
Assistance in setting up a custom method for Scipy Basinhopping
I'm trying to set a custom method for the local minimization. From my understanding of basinhopping, you start with an initial starting condition, minimize using a local method, then use basinhopping change the value of the parameters, and minimize…

samman
- 559
- 10
- 29
-1
votes
1 answer
I am optimizing f(x) using scipy.optimize.minimize and the value of f(x) cannot be negative but scipy.optimize returns a min value as negative
The minimized function value of f(x) should be greater than or equal to 0. However, scipy.optimize.minimize provides a negative value of f(x). Is there any way we could put a constraint on the function value?

Thescott
- 1