Skip to main content
Filter by
Sorted by
Tagged with
Best practices
0 votes
1 replies
25 views

import numpy as np from scipy.optimize import minimize x = np.linspace(-5, 5, 100) def function_to_minimize(*args): function = 0 for j in range(0, 4): a_j = args[j][0] b_j ...
Cody Payne's user avatar
0 votes
1 answer
101 views

I am trying to "minimize" using SLSQP in scipy module. With a lot of difficulty, I am trying to implement some constraints. I am encountering some strange error, thus unable to debug. My ...
Murali's user avatar
  • 25
1 vote
0 answers
121 views

I would like to use minimize from scipy.optimize to fit my data with a specific function: I defined this log likelihood to this aim: def log_likelihood(theta, freq, CPSD, CPSD_err): ''' This ...
Apinorr's user avatar
  • 338
1 vote
0 answers
51 views

Say I have a function f(x,y,z) I want to minimize using scipy.optimize.minimize. I want to minimize it subject to the constraint x < y < z. I don't think I can use the bounds argument to do this ...
Ben's user avatar
  • 539
0 votes
2 answers
65 views

I have a distance matrix between 2 sets of points ( sets A & B ). Each A point is associated with an equal number of B points ( if possible ). I want to minimize the standard deviation of average ...
Fabrice BOUCHAREL's user avatar
1 vote
1 answer
91 views

I have a function defined by f(x_0, x_1) = a(x_1 - x_0^2)^2 + (b - x_0)^2, where a and b are some parameters: def f(x): return a*(x[1]-x[0]**2)**2+(b-x[0])**2 where x=np.array([x_0,x_1]) is a numpy ...
Ishigami's user avatar
  • 592
0 votes
0 answers
108 views

SciPy's minimize() gives different results on different machines: sp.optimize.minimize(cost_function, x_init, bounds=x_bounds, args=args_in, method='SLSQP', options={'maxiter': sim_config['maxiter'], '...
AdityaT101's user avatar
0 votes
1 answer
129 views

Can I use Jacobi Preconditioning for the inner CG step in Truncated Newton Conjugate implementation of scipy? The options for the TNC solver do not include any support for preconditioning. I'm ...
atomr's user avatar
  • 3
0 votes
0 answers
82 views

I'm currently working on a project that involves multi-fidelity optimization using BoTorch. I'm trying to optimize an acquisition function, but I keep encountering a RuntimeError when I run the ...
Lisa Schmitt's user avatar
2 votes
1 answer
106 views

I wanted to abstract the following function that calculates minimum value of a objective function and values when we can get this minimal value for arbitrary number of g's. I started with simple case ...
to4ka's user avatar
  • 23
0 votes
1 answer
158 views

I have the following code which functions correctly. However, instead of using the method curve_fit, I want to perform the fitting manually using scipy.optimize.minimze on each element. Is it possible ...
user1134699's user avatar
0 votes
0 answers
32 views

General goal: I want to optimize parameters from the Rosenbrock function with the minimize function in a Python script. My result is already good but I want to use vectorization for the whole ...
pythonbeginner's user avatar
0 votes
1 answer
229 views

I am wondering how the 'ftol' paramater in scipy.optimize.minimize(method='SLSQP') is used. In the documentation it just says, that it is the precision goal for the value of f, which could mean ...
user25106562's user avatar
0 votes
1 answer
243 views

I am using scipy.minimize in an attempt to optmize the inputs to my function. I have a given amount of budget/hours and 6 inputs where I'm trying to get the highest return from the input mix. Each of ...
runningbirds's user avatar
  • 6,675
0 votes
0 answers
173 views

I am trying to solve constrained optimization problems using scipy.optimize.minimize with method='trust-constr'. My problems typically involve both equality and inequality nonlinear constraints. For ...
Scacco Matto's user avatar
0 votes
0 answers
55 views

Addressing a multi-variable function, Scipy minimizer will start with the smallest value in the initial guess array, regardless of the sort. Assuming that you are using the Nelder-Mead method, is ...
Amir Ghorbani's user avatar
-1 votes
1 answer
112 views

I am using Python in FEA a solver and i have an objective function to minimize. I thought about using scipy.optimize but it doesn't work. No optimization is carried out and no errors either... See ...
Pierre Lechevalier's user avatar
0 votes
1 answer
92 views

I need to minimize a function objective() that takes a list of tuples x as argument. But there's a catch : the tuples can only be choosen in a predefined set of tuples. A minimal example would be: ...
Dr. Paprika's user avatar
1 vote
1 answer
111 views

For context I'm using NumPy. I encountered the following warning message in my code RuntimeWarning: invalid value encountered in log model = ((-2*r) * np.log(1-s*np.sin(2*np.pi*t/p_orb-phi_orb)))...
Tihomb's user avatar
  • 13
0 votes
2 answers
93 views

Within python3, if I have a dictionary containing for example: d = {'C1': 0.68759, 'C2': -0.21432, 'H1': 0.49062, 'H2': -0.13267, 'H3': 0.08092, 'O1': -0.8604} And I have the equation: n1*d['C1'] + ...
scaldedolive's user avatar
0 votes
1 answer
204 views

I have some x, y and y_error data The ranges and for my data are roughly on orders of x data: [0,40] y data: [10^-14, 10^-12] y_error data: [10^-15, 10^-14] Plotting this yields the following graph: ...
shram's user avatar
  • 25
1 vote
1 answer
142 views

I am performing an optimization in Python using the 'SLSQP' method of the scipy optimization library. To improve the speed of Jacobian calculations, multiprocessing was applied to the cost function. ...
lee sunghyun's user avatar
0 votes
1 answer
230 views

I am trying to minimize this function but using scipy minimize i expect to get in return an array of the same size of the one in input, that is (92445,) but i get an array of size (92445, 92445) and ...
Federico Calabretti's user avatar
0 votes
1 answer
324 views

I am trying to solve a simple optimization problem but cant get around the error "positive directional derivative for linesearch" and am wondering what is going on here, i dont see anything ...
spline regressor's user avatar
0 votes
1 answer
182 views

I am trying to solve a linear equation (AX=b) where A is an 8x8 matrix, and X and b are 8x1 vectors. X can be expressed by X=[x1, y1, x2, y2, x3, y3, x4, y4]. However, I have the following 3 ...
Elie's user avatar
  • 59

1
2 3 4 5
10