mathematical-optimization

Best linearization for p-dispersion (maxmin) problem?

元气小坏坏 提交于 2020-01-06 03:53:05
问题 Partially related to my other question here. In my case the 'original' aim was to choose n=50 objects out of N=292, such that the sum of all pairwise distances between the chosen objects is maximized (maxsum or p-dispersion sum). Thanks to the users who provided advice, I did some further reading, and now I understand that the problem is indeed quadratic in its simplest form, and a solver like CPLEX may be able to solve it. However, this article by Kuby points out that the maxsum results does

Optimise a function with two parameters and constraints in R using solnp function?

混江龙づ霸主 提交于 2020-01-05 05:31:29
问题 I have the following function and would like to optimise parameters x and y in order to maximise the output. I am trying to do that using optimise . EDIT Thanks to the comments here I am able to optimise using Rsolnp::solnp . But now I get error when I add upper and lower bounds. See example below Ojective function: my_fn <- function(x) { z <- ifelse(x[1] < 1000000, 0, ifelse(x[1] < 19500000, x[1] * 0.0175, ifelse(x[1] < 20500000, x[1] * 0.0190, ifelse(x[1] < 21500000, x[1] * 0.0220, ifelse(x

IPOPT options for reducing constraint violation after fewer iterations

扶醉桌前 提交于 2020-01-04 06:57:09
问题 I am using IPOPT implemented through OpenMDAO and am having some trouble understanding and controlling the stopping criteria. Here is what I'm experiencing specifically: Initially, IPOPT is able to find a solution that appears to be much better, although constraints are violated slightly (intuition tells me that adjusting a few parameters would likely bring it into the feasible region). From this discussion I understand that "linear or nonlinear equality or inequality constraint will not

Mixed integer programming: variable assignment per condition (if then else)

不想你离开。 提交于 2020-01-03 05:20:10
问题 I am relatively new to (mixed) integer programming and got stuck with the formulation of a constraint. In my simplified model I have one Parameter and two Variables that are positive Reals having the value 321 as upper bound. The logic I want to express is here: if Parameter > Variable1: Variable2 = Variable1 else: Variable2 = Parameter **edit** (while Variable1 is always >= Variable2) Is it actually possible to describe this using linear in(equalities)? If it helps: For the implementation I

Solve for maximum likelihood with two parameters under constraints

本秂侑毒 提交于 2020-01-02 13:51:52
问题 I'm trying to implement a beta-geometric probability model in R (as described in this whitepaper) which involves solving an equation with two unknown parameters. In the example, they use Excel to do this, starting the values off at alpha = beta = 1 and constraining them to alpha > 0.0001 < beta . I've nearly implemented this in R , but I can't seem to make any solver work for me. Please help. RFiddle here # probability mass function P = function (alpha, beta, t) { out = numeric(length=length

Statsmodels logistic regression convergence problems

大憨熊 提交于 2020-01-02 13:37:12
问题 I'm trying to run a logistic regression in statsmodels on a large design matrix (~200 columns). The features include a number of interactions, categorical features and semi-sparse (70%) integer features. Although my design matrix is not actually ill-conditioned, it seems to be somewhat close (according to numpy.linalg.matrix_rank , it is full-rank with tol=1e-3 but not with tol=1e-2 ). As a result, I'm struggling to get logistic regression to converge with any of the methods in statsmodels.

Algorithm to optimize # threads used in a calculation

笑着哭i 提交于 2020-01-02 05:42:46
问题 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,

Passing arguments in nonlinear optimization function `nloptr`

人走茶凉 提交于 2020-01-02 04:47:22
问题 My initial question can be found here:Optimization in R with arbitrary constraints It led to another question how to pass arguments into nloptr . I need to minimize a function F(x,y,A) where x and y are vectors and A is a matrix, while having constrains that sum(x * y) >= sum(y/3) and sum(x)=1 . I have tried to use nloptr : F <- function(x,y,A){ ... } Gc <- function(x,y){ return(sum(y/3) - sum(x*y)) } Hc <- function(x){ retunr(1-sum(x)) } nloptr(x0=rep(1/3,3), eval_f=F, lb = 0.05, ub = 1,

Non Linear Integer Programming

╄→尐↘猪︶ㄣ 提交于 2020-01-01 10:49:10
问题 I would like to know if there is a package in R handling non linear integer optimization. "Basically", I would like to solve the following problem: max f(x) s.t x in (0,10) and x is integer . I know that some branching algorithms are able to handle the linear version of this problem, but here my function f() might be more complicated. (I can't even make sure it would be quadratic of the form f(x)=xQx ). I guess there is always the brute force solution to test all the possibilities as long as

Merging and splitting overlapping rectangles to produce non-overlapping ones

余生长醉 提交于 2020-01-01 07:02:29
问题 I am looking for an algorithm as follows: Given a set of possibly overlapping rectangles (All of which are "not rotated", can be uniformly represented as (left,top,right,bottom) tuplets, etc...), it returns a minimal set of (non-rotated) non-overlapping rectangles, that occupy the same area. It seems simple enough at first glance, but prooves to be tricky (at least to be done efficiently). Are there some known methods for this/ideas/pointers? Methods for not necessarily minimal, but