minimize

Python Scipy Optimization.minimize using SLSQP showing maximized results

。_饼干妹妹 提交于 2019-12-22 04:25:50
问题 I am learning to optimize a multivariate constrained nonlinear problem with scipy.optimize.minimize ,but received strange results. My problem: minimize objfun objfun x*y constraints 0<=x<=5, 0<=y<=5, x+y==5 My code: from scipy import optimize def func(x): return x[0]*x[1] bnds=((0,100),(0,5)) cons=({'type':'eq','fun':lambda x:x[0]+x[1]-5}) x0=[0,0] res= optimize.minimize(func,x0,method='SLSQP',bounds=bnds,constraints=cons) Received results: status: 0 success: True njev: 2 nfev: 8 fun: 6

Optimization in R: Maximizing and Minimizing Many Variables

只愿长相守 提交于 2019-12-21 20:25:03
问题 I have a dataset with 70 foods and information about each food's nutritional value (protein/oz., fat/oz., cals/oz., etc.), as well as the food's cost/oz. I am trying to figure out--given a set budget in $--what the best combination of foods (and the amt. of each food) would be to maximize protein, minimize fat, minimize calories, etc. I aim to do this across a series of price points, and to plot each. I found a whole bunch of different packages that could help with this here: http://cran.r

How to bring chrome to foreground from a web app

人盡茶涼 提交于 2019-12-20 06:20:14
问题 Is there any windows apps/google chrome flags/google chrome extension/javascript methods or any other thing that would allow to bring a chrome window from background(minimized) to foreground when something happens inside a website. I do have access to the client computer, I could set chrome flags/kiosk mode or anything that would prevent it from opening to foreground if it's possible. For example I am trying to bring the window to foreground when an order comes in, through a notification (I'm

NoClassDefFoundError Crash on Minimizing Youtube Player on Android 4.0, 4.2, 4.4

独自空忆成欢 提交于 2019-12-20 02:09:18
问题 Problem : Youtube Player crashes on minimizing youtube player activity/Fragment in the app. Cause : Youtube Player Update Code public class YouTubePlayerActivity extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener { private static final int RECOVERY_DIALOG_REQUEST = 1; private final String TAG = YouTubePlayerActivity.class.getSimpleName(); private YouTubePlayerView youTubeView; private String videoId; private YouTubePlayer youtubePlayer; @Override protected void

How could I detect when my application is minimized?

人走茶凉 提交于 2019-12-19 21:26:13
问题 I have a program with an option to enable minimizing to the taskbar's notification area. In order for this to work, I need a reliable way of detecting when the user has minimized the application. How can I do that using the Windows API in a C++ application? 回答1: When the user minimizes the window (either using the box on the title bar, or by selecting the "Minimize" option from the system menu), your application will receive a WM_SYSCOMMAND message. The wParam parameter of that message will

Generate minimized jar with only used classes

时光总嘲笑我的痴心妄想 提交于 2019-12-19 13:48:43
问题 I'm in need of creating the minimal jar of utils library for use in Android. I'm using some methods from apache commons libraries (such as IOUtils , StringUtils ). However, each such usage makes me import the whole library ( commons-lang , commons-io etc.) which is absolutely acceptable under Tomcat ( war 's are mamoot-sized anyway), but absolutely unacceptable for Android project. So, my aim is, to pack all used classes from dependencies into one jar - but only that classes that are needed.

Optimisation using scipy

ぃ、小莉子 提交于 2019-12-19 09:56:27
问题 In the following script: import numpy as np from scipy.optimize import minimise a=np.array(range(4)) b=np.array(range(4,8)) def sm(x,a,b): sm=np.zeros(1) a=a*np.exp(x) sm += sum(b-a) return sm x0=np.zeros(4) print sm(x0,a,b) #checking my function opt = minimize(sm,x0,args=(a,b),method='nelder-mead', options={'xtol': 1e-8, 'disp': True}) I am trying to optimise for x but I am having the following message: Warning: Maximum number of function evaluations has been exceeded. And the result is:

Binding the “WindowState” property of a window in WPF using MVVM

点点圈 提交于 2019-12-19 06:05:40
问题 I bound the "WindowState" property of my main window to my ViewModel in order to change the state of the window by a command, but the first time I minimize the window it minimizes like a worksheet does in an Excel file. Is there a work around for this or a correct way to bind the "WindowState" property to my ViewModel so that the window minimizes correctly? 回答1: I don't think you should care about the window state in a view model, it's completely wrong because a lower-level layer is aware of

Restrict scipy.optimize.minimize to integer values

旧巷老猫 提交于 2019-12-18 19:08:42
问题 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,

Pocket PC/Windows Mobile: How to detect smart minimize

徘徊边缘 提交于 2019-12-18 16:27:22
问题 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