# Questions tagged [optimization]

Optimization is the act of improving a method or design. In programming, optimization usually takes the form of increasing the speed of an algorithm, or reducing the resources it requires. Another meaning of optimization is numerical optimization algorithms used in machine learning.

**-1**

votes

**0**answers

5 views

### Can I host my Website while I continue to work on it with out wrecking my Google rank?

According to most sources it can take anywhere between 4 days and 6 months before Google will index a new site.
I am currently half way through the production stage of my new website. At this point ...

**1**

vote

**0**answers

42 views

### Anyway to hint compiler to optimize out scope_failure's destructor when there is no exception?

Consider the following code:
# include <exception>
# include <cassert>
# define INLINE [[gnu::always_inline]]
template <class F>
class scope_failure
{
F f;
public:
...

**1**

vote

**0**answers

18 views

### Optimized the color render function

I have a big data to handle.
They need to be classified into 4 colors, and render to the SVG.
My function is:(parameter A B C are used to do something....)
function mapRender(dataArray,A,B,color1,...

**0**

votes

**0**answers

15 views

### Excel solver in Python for minimize a function

I am dealing with a minimization problem and I want to know if the Excel Solver add-in can be replicated in Python. I am doing it with scipy.optimize.minimize and I get an approximation but not ...

**0**

votes

**0**answers

9 views

### How to model a specific optimization problem?

I have a specific problem and don't know how to change it to a feasibility or optimization problem. Can anyone please help me?
I want to find the values of variables such that the minimum value of a ...

**0**

votes

**1**answer

15 views

### Efficient way to apply highpass to 1D signal in 2D matrix

I have a very huge array, and each column is a different signal, is there a way to do this efficiently without using looping as below?
in_data=rand(2000,100000);
for j=1:size(in_data,2)
in_data(:...

**0**

votes

**0**answers

7 views

### Loss does not decrease when I train Pose network

I've train Pose Detection Network.
2 Weeks ago, I finally trained Pose network and it works well.
So, I add 3d_conv and rnn to Pose network and it's loss doesn't decrease.
well.. there are two loss ...

**0**

votes

**0**answers

13 views

### How do I plot constraints of multivariate optimization using R to find the feasible region

I'm new to optimization using R.I'm using lpSolveAPI to do the optimization.I'm using R-3.5.1 in Windows 10.My objective function & the constraints using dummy data looks like following
/* ...

**0**

votes

**0**answers

22 views

### MATLAB parfor doesn't speed up any of my array operations.

I have been trying to optimize my to compute array operations in Matlab using parfor, however, when I tried using par for on the outer loop (v loop) the runtime increased significantly due to the ...

**0**

votes

**0**answers

11 views

### optimization problem, minimize from a matrix with constraints

I'm trying to find a minimum for a function which takes a 5x4 matrix shown below.
def objective(w):
...
return value
# Random Initial Input Matrix where rows sum up to 1.0
w = array(
[[...

**1**

vote

**1**answer

11 views

### identify whether an ELF binary is built with optimizations

I know we can use cmake or make to control CFLAGS or CXXFLAGS for building release version manually. release version to me means -O2 or -O3 is given at least, it doesn't matter whether -g or strip is ...

**0**

votes

**0**answers

18 views

### how to fit a complex model to complex data

My aim is to fit gaussian-hermite-polynoms to complex measurement data (consisting out of absolute and an phase part). There are seven independent parameters (p) to generate such an gaussian-hermite-...

**0**

votes

**1**answer

21 views

### Pairwise distance of different elements in pandas

I have a dataframe with some different elements, identified by an ID. For each of them LAT, LON are provided. A sample is provided below:
ID LAT LON
2426 0.351649 36.921941
2451 0....

**0**

votes

**1**answer

30 views

### How to find the best parameters which maximizes a function?

I have a function which takes 8 parameters, 5 (a,b,c,d,e) of which are constants while the other three (u1, u2, u3) are to be found out.
a <- 10.1
b <- 2.45
c <- 0.35
d <- 2
e <- 3.5
...

**0**

votes

**0**answers

20 views

### Optimal technique for filter links that have parent-child dependencies and fixed URL positions

I am currently building a real estate website using CodeIgniter. Because of digital marketing planning I have a fixed structure for the URL which follows this set of rules:
root /...

**0**

votes

**1**answer

43 views

### MySQL ORDER BY CASE optimization

I looked over the internet, but I couldn't find a solution for this particular query. I have this query:
SELECT *
FROM profile
ORDER BY CASE WHEN country_geoname_id = 2635167
THEN 1 ...

**0**

votes

**0**answers

12 views

### Why the below equation doesn't include “N” noise to the Lagrangian function? Can somebody explain it to me? Thanks

I am unable to understand the below equation for Lagrangian function. What I know that the Lagrangian function should also include "N" noise part of the constraint in the equation when converting the ...

**0**

votes

**0**answers

15 views

### How to add constatnt in optimization function using lpsolveAPI

My objective function is like below
z=10x1+K1+5x2+k2+2x3+k3 & min(z)
where K1 to k3 are constant.
for variables I can write
library(lpSolveAPI)
lprec <- make.lp(5,6)
set.objfn(lprec, obj=c(...

**0**

votes

**0**answers

17 views

### finding the pvalues of a nonnegative least squares solution

I am using matlab and I wanted to ask how I can generate the pvalues of the coefficients in a nonnegative least squares solver.
For example, if I use the function 'fitlm', it shows the solutions and ...

**-2**

votes

**1**answer

54 views

### Check matches with 3's in a set of 6 numbers across 49 number draws

I am using select within Sidekiq:
require 'set'
require 'benchmark'
all_numbers = (1..49).to_a.combination(6)
needle = [1,2,3,4,5,6].to_set
Benchmark.bm do |x|
x.report { all_numbers.select{|z| (...

**1**

vote

**2**answers

71 views

### How to use multi-threading to speed up nested for loop calculation?

I'm trying to perform numerical integration on a large array and the computation takes a very long time. I tried to speed up my code by using numba and the jit decorator, but numpy.trapz isn't ...

**0**

votes

**1**answer

43 views

### How to calculate mean per group from list of data.tables?

Let's say we have a list of data.table's like this:
dt <- data.table(x=rnorm(10^6,100,10), letters=sample(LETTERS,10^6,T))
myList <- list(dt1=dt,dt2=dt,dt3=dt,dt4=dt,dt5=dt)
If I wanted a ...

**0**

votes

**1**answer

16 views

### JVM - effect of Xms on commited memory and garbage collection

We have a tomcat with following arguments
Xms 1g
Xmx 4g
Parallel GC
It is installed in Ubuntu machine with JVM 1.8.181
Lately GC is being started with full throttle and doesn't let any other process ...

**0**

votes

**0**answers

24 views

### Send N agents through directed graph with minimum cost

I have a problem of sending N agents from source vertex 'src' to a destination vertex 'dst' of a directed graph which edges weights are increasing linear functions of n (n is the number of agents that ...

**0**

votes

**1**answer

18 views

### MultivariateOptimizer is abstract; cannot be instantiated error when trying to optimize a function in Java

Ok I'm trying optimize a Poisson likelihood function and I'm getting the error: "MultivariateOptimizer is abstract; cannot be instantiated", below is my code:
package javaapplication1;
...

**0**

votes

**1**answer

58 views

### How do I minify the following series of for loops into a less compact code?

I have the following code which follows a pattern of loops , I have a feeling that code can be minified to a recursion like code or any less ugly looking code , but I am unable to figure it out.
I ...

**-1**

votes

**0**answers

17 views

### Plotting optimised parameters using the optim()

I am facing a problem whereby upon optimising a function with various starting parameters, optimised values are returned and i have plotted them into a plot.
However, I have attained the following ...

**0**

votes

**0**answers

23 views

### Non Linear optimization in R

I'm new in R. I have to do Non Linear optimization using R. My objective function is like this
z=sum(a-x)*b
I have to maximize z, by changing x. My constraints are in this form
exp(zz[i] + pf[i]*...

**1**

vote

**1**answer

42 views

### How to handle large integers in IBM ILOG CPLEX CP Optimizer?

This is a follow-up from this post. In short, I am using IBM ILOG CPLEX CP Optimizer in Python to solve a constraint programming problem. One of the optimization objectives is to maximize the product ...

**0**

votes

**0**answers

35 views

### Speed up np.trapz calculation with Numba

I have these large numpy arrays, which I'm using np.trapz to numerically integrate over.
Currently, my code takes an extremely long time to compute and I was hoping to use numba to speed up the ...

**0**

votes

**1**answer

34 views

### Numba @jit fails to speed up the performance of this function. Anyway to fix that?

I am quite new to the numba package in python. I am not sure if I am using the numba.jit correctly, but the code just runs too slow with 23.7s per loops over the line: Z1 = mmd(X,Y,20)
What is the ...

**-1**

votes

**1**answer

13 views

### convergence of an ant colony algorithm

I use ant colony optimization to solve a problem. In my case, at each iteration, n ants are generated from n nodes (one ant per node every iteration). I obtain solutions that verify the conditions of ...

**-1**

votes

**1**answer

92 views

### Calculating Manhatten distance between all pairs

I have a list(vector in c++) of (x,y) coordinates of some vertices from a matrix e.g [ (0,2) , (0,3) , (1,2) , (2,2) ] . I want to calculate Manhattan distance between each pair of vertices in the ...

**1**

vote

**0**answers

43 views

### How to make emscripten to generate better code

I have read lots about how fast Emscripten code can be, thus I decided to convert my js application to C++ and then compile to Emscripten. I got about +30% speed increase and it's not the thing I ...

**1**

vote

**0**answers

9 views

### How to optimize the Facebook comments thumbnails on google speed insights report?

I'm optimizing my blog and I have this issue with the facebook commenting plugin. it retrieved the thumbnails images not optimized and it's affecting the loading speed according to google speed ...

**0**

votes

**0**answers

20 views

### Optimizing Cython: 5-byte string or size_t?

I'm writing a Cython module that deals with large numbers of 5-byte keys retrieved from a key-value store. I settled on 5 because it gives me enough room for combinations (~5 trillion) for very little ...

**3**

votes

**0**answers

30 views

### How to make a infinite scroll, dynamically render a list in Vue js (only visible)

I have a very large array of objects with a lot of data to be rendered by a Vue in components to the DOM, And i guess the best approach to do this is render only the HTML that is going to be visible, ...

**1**

vote

**1**answer

43 views

### Speed Up Simple Multidimensional Counter Code

This is the slow code:
def doCounts(maskA1, maskA2, maskA3, counts, maskB):
counts[0, maskB & maskA1] += 1
counts[1, maskB & maskA2] += 1
counts[2, maskB & maskA3] += 1
Is ...

**2**

votes

**1**answer

40 views

### Why ReactJS bundle size in development mode is smaller than production mode?

I'm trying to create my own Webpack configuration for a ReactJS project, I started with one component that displays single div.
The configuration seems to work pretty well, but the bundle size in ...

**0**

votes

**1**answer

36 views

### Flush-to-zero denormals - is it reliable?

For signal processing this has been an issue like forever and right I'm still taking precautions of adding a small constant whenever a denormal can happen, e.g.:
float coef = 0.9f;
for (int i=0; i<...

**4**

votes

**1**answer

73 views

### C loop unrolling optimization performance

First: I know what loop optimization is and how it works yet I found a case where I cannot explain the results.
I created a prime number checker that calls modulo on each number from 2 to n - 1, so ...

**0**

votes

**0**answers

36 views

### Energy impact aware coding iPhone XS vs iPhone 7

I have to keep an eye on graphics and energy performance of my app because of a lot of scrollViews and a lot of UIColor.white on the screen.
So far I managed to keep the energy impact in the green ...

**1**

vote

**1**answer

24 views

### URI images - Database column v/s class file

I am developing a web app that populates a different image on every page, based on some logic. There are 20,000 images stored as URI in my database in a read only table.
Would it be better if I ...

**0**

votes

**1**answer

21 views

### Linear programming for wait time optimization

I am trying to solve a problem using simplex method.Although this is a mathematical problem, I need to solve it using any programming language.I am stuck at basic phase itself about dealing those ...

**0**

votes

**0**answers

15 views

### Django order_by cosine similarity faster

class Item(models.Model):
vector_repr = models.TextField(..., verbose_name='jsonified vector representation')
...
# My current solution:
def as_vector(item): return np.asarray(json.loads(item....

**-3**

votes

**2**answers

47 views

### Inserting A Certain String In-between A List Of Strings [on hold]

My assignment is to take the string "like" and place it in between a list of strings.
Here is what I have so far:
public String teenTalk(String sentence) {
String megaNut = ("like");
for (...

**-2**

votes

**3**answers

72 views

### This an + bnlog2(n) + cn3 = k, finding n here for bigger input is not working properly [on hold]

I had to solve a problem in a exam. But it couldn't pass all the test cases. It was this equation.
an + bnlog2(n) + cn3 = k where a,b,c,k are given. That position can be max 2^63 -1
suppose the ...

**-1**

votes

**0**answers

16 views

### How to use talos to optimise eras models for a regression problem?

I ma trying to use talos package to optimise my keras model for a regression problem. I didn't manage to get it working. I receive this error:
AttributeError: 'Scan' object has no attribute '_y_range'...

**0**

votes

**0**answers

50 views

### not able to access records from Mongodb

In Mongodb I have around 22.7 million documents of size 6.6 GB. While accessing it from python console the query take too much time and in the end connection is refused because database in server and ...

**-4**

votes

**0**answers

28 views

### Reporting & data generating with PHP + MySQL [closed]

Once a week PHP script is collecting data to generating weekly reports but this operation overloads our server for several minutes.
What would be your tips about optimizing the data generating ...