mathematical-optimization

Tell scipy.optimize.minimize to fail

亡梦爱人 提交于 2019-12-05 18:46:38
I'm using scipy.optimize.minimize for unrestricted optimization of an objective function which receives a couple of parameters and runs a complex numerical simulation based on these parameters. This simulation does not always converge in which case I make the objective function return inf, in some cases, in others NaN. I thought that this hack would prevent the minimization from converging anywhere near a set of parameters that makes the simulation diverge. Instead, I encountered a case where the simulation won't even converge for the starting set of parameters but instead of failing, the

Rsolnp: In cbind(temp, funv) : number of rows of result is not a multiple of vector length (arg 1)

你说的曾经没有我的故事 提交于 2019-12-05 18:17:49
I'm new to stackoverflow and searched a lot, but couldn't find an answer to my question. I'm trying to minimise the problem bellow with the optimisation package Rsolnp. Although the solver gives me a solution, every time I run the code I get the following warning message: Warning messages: 1: In cbind(temp, funv) : number of rows of result is not a multiple of vector length (arg 1) Furthermore, the solution is completely different from the solutions I get with ipop and solve.QP. Their solutions are almost the same (0.2480, 0.0000, 0.0121, 0.7400). I tried many different formulations of the

Linear Algebra Library For Android [closed]

馋奶兔 提交于 2019-12-05 17:44:19
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Does anyone know what will be a good library for computing linear algebra in Android (SVD, QR, LU, least-squares, inverse, etc) ? 回答1: The conventional Linear Algebra libraries are implemented in layers. Basic Linear Algebra Subprogram (BLAS) is in the bottom layer. Linear Algebra Package (LAPACK) is built on

Why does adding Crossover to my Genetic Algorithm gives me worse results?

做~自己de王妃 提交于 2019-12-05 17:43:02
问题 I have implemented a Genetic Algorithm to solve the Traveling Salesman Problem (TSP). When I use only mutation, I find better solutions than when I add in crossover. I know that normal crossover methods do not work for TSP, so I implemented both the Ordered Crossover and the PMX Crossover methods, and both suffer from bad results. Here are the other parameters I'm using: Mutation : Single Swap Mutation or Inverted Subsequence Mutation (as described by Tiendil here) with mutation rates tested

Algorithm to optimize # threads used in a calculation

别来无恙 提交于 2019-12-05 16:14:00
I'm performing an operation, lets call it CalculateSomeData. CalculateSomeData operates in successive "generations", numbered 1..x. The number of generations in the entire run is fixed by the input parameters to CalculateSomeData and is known a priori. A single generation takes anywhere from 30 minutes to 2 hours to complete. Some of that variability is due to the input parameters and that cannot be controlled. However, a portion of that variability is due to things like hardware capacities, CPU load from other processes, network bandwidth load, etc. One parameter that can be controlled per

Find the Discrete Pair of {x,y} that Satisfy Inequality Constriants

戏子无情 提交于 2019-12-05 10:45:48
I have a few inequalities regarding {x,y} , that satisfies the following equations: x>=0 y>=0 f(x,y)=x^2+y^2>=100 g(x,y)=x^2+y^2<=200 Note that x and y must be integer. Graphically it can be represented as follows, the blue region is the region that satisfies the above inequalities: The question now is, is there any function in Matlab that finds every admissible pair of {x,y} ? If there is an algorithm to do this kind of thing I would be glad to hear about it as well. Of course, one approach we can always use is brute force approach where we test every possible combination of {x,y} to see

Sorting points such that the minimal Euclidean distance between consecutive points would be maximized

℡╲_俬逩灬. 提交于 2019-12-05 09:13:49
Given a set of points in a 3D Cartesian space, I am looking for an algorithm that will sort these points, such that the minimal Euclidean distance between two consecutive points would be maximized. It would also be beneficial if the algorithm tends to maximize the average Euclidean distance between consecutive points. Edit: I've crossposted on https://cstheory.stackexchange.com/ and got a good answer. See https://cstheory.stackexchange.com/questions/8609/sorting-points-such-that-the-minimal-euclidean-distance-between-consecutive-poin . Here is a lower bound for the cost of the solution, which

Optimization in R with arbitrary constraints

霸气de小男生 提交于 2019-12-05 07:35:04
问题 I have done it in Excel but need to run a proper simulation in R. I need to minimize function F(x) ( x is a vector) while having constraints that sum(x)=1 , all values in x are [0,1] and another function G(x) > G_0 . I have tried it with optim and constrOptim . None of them give you this option. 回答1: The problem you are referring to is (presumably) a non-linear optimization with non-linear constraints. This is one of the most general optimization problems. The package I have used for these

Constrained optimization for nonlinear multivariable function in Java

拟墨画扇 提交于 2019-12-05 02:50:26
I am looking for an open source implementation of a method doing constrained optimization for nonlinear multivariable function in Java . There are several open source java implementations that can do this, such as: OptaPlanner (apache license, 100% java, lots of examples and documentation) jacop choco ... IPOPT is the most robust solver I know of. It has a Java interface although I have no idea how good that is, I only use the C++ API. I recently ported Michael Powells' COBYLA2 derivative-free optimizer for nonlinear objective functions and constraints to Java. You'll find the source code here

Stochastic Optimization in Python

a 夏天 提交于 2019-12-04 22:17:39
问题 I am trying to combine cvxopt (an optimization solver) and PyMC (a sampler) to solve convex stochastic optimization problems . For reference, installing both packages with pip is straightforward: pip install cvxopt pip install pymc Both packages work independently perfectly well. Here is an example of how to solve an LP problem with cvxopt : # Testing that cvxopt works from cvxopt import matrix, solvers # Example from http://cvxopt.org/userguide/coneprog.html#linear-programming c = matrix([-4