minimize

Bounded root finding in scipy

倖福魔咒の 提交于 2019-12-01 04:50:49
问题 Scipy offers several seemingly equivalent functions for finding the root of a function in a given interval: brentq(f, a, b[, args, xtol, rtol, maxiter, ...]) Find a root of a function in given interval. brenth(f, a, b[, args, xtol, rtol, maxiter, ...]) Find root of f in [a,b]. ridder(f, a, b[, args, xtol, rtol, maxiter, ...]) Find a root of a function in an interval. bisect(f, a, b[, args, xtol, rtol, maxiter, ...]) Find root of a function within an interval. (See this webpage.) Can anyone

Want to do multi-variation minimize with sympy

Deadly 提交于 2019-12-01 03:04:15
问题 I want to use minimization with scipy.optimize using Symbolized charactors from scipy.optimize import minimize from sympy.utilities.lambdify import lambdify import sympy as sp x1, x2, x3, x4 = sp.symbols('x1 x2 x3 x4') FormulaMain = sp.symbols('-2*x1**2*x3+6*x1**2*x4+13*x1**2-3*x1*x2**2+x1*x2+3*x1*x3**2-3*x4+103') HandleMain = lambdify((x1,x2,x3,x4),FormulaMain,'numpy') bnds = ((-1, 1), (-1, 1), (-1, 1), (-1, 1)) PrintParams = minimize(HandleMain,[1,1,1,1],method='SLSQP',bounds=bnds) print

IE is randomly minimizing when a link is clicked

风流意气都作罢 提交于 2019-12-01 01:08:00
问题 I have the bizarre problem. When I click on a link in IE7 the window minimizes. It seems to only be a subset of the links on the page. It also doesn't consistently happen with the same link and differs from computer to computer. example link text: <a hidefocus="on" href="#" tabindex="1"><span unselectable="on" id="extdd-102">Canadian Legislation</span></a> Anyone seen this before or have any idea what might be causing it? 回答1: Finally figured it out. It was actually a custom JavaScript click

Scipy.optimize Inequality Constraint - Which side of the inequality is considered?

你说的曾经没有我的故事 提交于 2019-11-30 19:06:48
I am using the scipy.optimize module to find optimal input weights that would minimize my output. From the examples I've seen, we define the constraint with a one-sided equation; then we create a variable that's of the type 'inequality'. My question is how does the optimization package know whether the sum of the variables in my constraint need to be smaller than 1 or larger than 1? ... def constraint1(x): return x[0]+x[1]+x[2]+x[3]-1 .... con1 = {'type': 'ineq', 'fun': constraint1} link to full solution I'm using in my example: http://apmonitor.com/che263/index.php/Main/PythonOptimization

Restrict scipy.optimize.minimize to integer values

走远了吗. 提交于 2019-11-30 18:48:34
I'm using scipy.optimize.minimize to optimize a real-world problem for which the answers can only be integers. My current code looks like this: from scipy.optimize import minimize def f(x): return (481.79/(5+x[0]))+(412.04/(4+x[1]))+(365.54/(3+x[2]))+(375.88/(3+x[3]))+(379.75/(3+x[4]))+(632.92/(5+x[5]))+(127.89/(1+x[6]))+(835.71/(6+x[7]))+(200.21/(1+x[8])) def con(x): return sum(x)-7 cons = {'type':'eq', 'fun': con} print scipy.optimize.minimize(f, [1,1,1,1,1,1,1,0,0], constraints=cons, bounds=([0,7],[0,7],[0,7],[0,7],[0,7],[0,7],[0,7],[0,7],[0,7])) This yields: x: array([ 2.91950510e-16, 2

Minimize / Maximize div's with jQuery

若如初见. 提交于 2019-11-30 18:30:27
I basically want to minimise some div's . Instead of using "-" and "+", I want to use some symbols (from font-awesome) to minimise and maximise the div's. My question concerning this; how can I insert the classes of the icons in this piece of code? I tried by replacing the .html part with .attr, but that didn't worked out. <script> $(".btn-minimize").click(function(){ if($(this).html() == "-"){ $(this).html("+"); } else{ $(this).html("-"); } $(".widget-content").slideToggle(); }); </script> Thanks a lot. Update: Thanks a lot for your help so far. But the sibling part doesn't really fit me

Scipy.optimize Inequality Constraint - Which side of the inequality is considered?

折月煮酒 提交于 2019-11-30 16:55:56
问题 I am using the scipy.optimize module to find optimal input weights that would minimize my output. From the examples I've seen, we define the constraint with a one-sided equation; then we create a variable that's of the type 'inequality'. My question is how does the optimization package know whether the sum of the variables in my constraint need to be smaller than 1 or larger than 1? ... def constraint1(x): return x[0]+x[1]+x[2]+x[3]-1 .... con1 = {'type': 'ineq', 'fun': constraint1} link to

How to show a form again after hiding it?

落花浮王杯 提交于 2019-11-30 15:54:52
问题 I have two forms. I need to open a second form with a button. When I open form2 I hide form1. However when I try to show form1 again from form2 with a button it doesn't work. My form1 code is: Form2 form2 = new Form2(); form2.ShowDialog(); Inside form2 code: Form1.ActiveForm.ShowDialog(); or Form1.ActiveForm.Show(); or form1.show(); (form1 doesn't exist in the current context) doesn't work. I do not want to open a new form Form1 form1 = new Form1(); form1.ShowDialog(); I want show the form

How to show a form again after hiding it?

笑着哭i 提交于 2019-11-30 15:21:40
I have two forms. I need to open a second form with a button. When I open form2 I hide form1. However when I try to show form1 again from form2 with a button it doesn't work. My form1 code is: Form2 form2 = new Form2(); form2.ShowDialog(); Inside form2 code: Form1.ActiveForm.ShowDialog(); or Form1.ActiveForm.Show(); or form1.show(); (form1 doesn't exist in the current context) doesn't work. I do not want to open a new form Form1 form1 = new Form1(); form1.ShowDialog(); I want show the form which I hided before. Alternatively I can minimize it to taskbar this.WindowState = FormWindowState

Pocket PC/Windows Mobile: How to detect smart minimize

核能气质少年 提交于 2019-11-30 13:50:17
How do I detect when my Compact Framework application is being smart-minimized (smart minimize is what happens when the user clicks the "X" button in the top-right corner on a Pocket PC)? The Deactivate event isn't the right way because it occurs in circumstances other than minimization, such as when a message box or another form is shown on top of the main form. And the form's WindowState doesn't help because there is no "Minimized" WindowState on .NET CF. I heard that by setting MinimizeBox = false, my app will be closed instead of minimized. But I actually don't want my app to close, I just