mathematical-optimization

3 dimensional bin packing algorithms

I'm faced with a 3 dimensional bin packing problem and am currently conducting some preliminary research as to which algorithms/heuristics are currently yielding the best results. Since the problem is NP hard I do not expect to find the optimal solution in every case, but I was wondering: 1) what are the best exact solvers? Branch and...

MATLAB: Question about minimizing a function containing an integral

Does anyone know how to minimize a function containing an integral in MATLAB? The function looks like this: L = Int(t=0,t=T)[(AR-x)dt], A is a system parameter and R and x are related through: dR/dt = axRY - bR, where a and b are constants. dY/dt = -xRY I read somewhere that I can use fminbnd and quad in combination but I am not a...

System.Math un identified

using System; using System.Math; class test { public static void Main() { Console.Write("Enter any value: "); string s=Console.ReadLine(); double n = double.Parse(s); double r = Math.sqrt(n); Console.WriteLine(r); Console.ReadKey(); ...

optimized grid for rectangular items

I have N rectangular items with an aspect ratio Aitem (X:Y). I have a rectangular display area with an aspect ratio Aview The items should be arranged in a table-like layout (i.e. r rows, c columns). what is the ideal grid rows x columns, so that individual items are largest? (rows * colums >= N, of course - i.e. there may be "unused" ...

Optimizing mathematics on arrays of floats in Ada 95 with GNAT

Consider the bellow code. This code is supposed to be processing data at a fixed rate, in one second batches, It is part of an overal system and can't take up too much time. When running over 100 lots of 1 seconds worth of data the program takes 35 seconds (or 35%), executing this function in a loop. The test loop is timed specifically ...

What is a data structure for quickly finding non-empty intersections of a list of sets?

I have a set of N items, which are sets of integers, let's assume it's ordered and call it I[1..N]. Given a candidate set, I need to find the subset of I which have non-empty intersections with the candidate. So, for example, if: I = [{1,2}, {2,3}, {4,5}] I'm looking to define valid_items(items, candidate), such that: valid_items(I,...

Quadratic Programming in C# / .NET

Does anyone know of a free package that will solve quadratic programming problems in C#? I've googled and found a few. But its hard to tell which is the best and fastest so I was just wondering if anyone had a favorite. ...

Merging and splitting overlapping rectangles to produce non-overlapping ones

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 ...

Linear Algebra Library For Android

Does anyone know what will be a good library for computing linear algebra in Android (SVD, QR, LU, least-squares, inverse, etc) ? ...

Mathematics - Why is Differential Calculus (MVP) in PHP a tabu?

Hi I want to do a Mean-Variance-Optimization (Markowitz) but i never found anything written in php that does this. MVP needs differential calculus. Can it be done in php and why arent there any classes/works from universities? For a webapplication (regarding performance) would another language be the better choice to handle heavy calc...

How to use constraint programming for optimizing shopping baskets?

I have a list of items I want to buy. The items are offered by different shops and different prices. The shops have individual delivery costs. I'm looking for an optimal shopping strategy (and a java library supporting it) to purchase all of the items with a minimal total price. Example: Item1 is offered at Shop1 for $100, at Shop2 fo...

Speeding up Math calculations in Java

I have a neural network written in Java which uses a sigmoid transfer function defined as follows: private static double sigmoid(double x) { return 1 / (1 + Math.exp(-x)); } and this is called many times during training and computation using the network. Is there any way of speeding this up? It's not that it's slow, it's just th...

Code optimization on minutes pr hour calculation

Hi All, The following code takes a timeframe in minutes since midnight and creates an array with minutes pr hour. But, it's slow. Any better suggestions out there? (no, changing language is not an option :-) ) Const clDeparture As Long = 123 Const clArrival As Long = 233 Dim lHour As Long Dim lMinute As Long Dim...

How computer multiplies 2 numbers?

How does a computer perform a multiplication on 2 numbers say 100 * 55. My guess was that the computer did repeated addition to achieve multiplication. Of course this could be the case for integer numbers. However for floating point numbers there must be some other logic. Note: This was asked in an interview. ...

Which are the best LGPL Libraries for Numerical Methods, Optimization Techniques, DOE, Sensitivity Analysis?

I wish to perform some mathematical operations including Design of Experiments, Optimization Techniques, Sensitivity Analysis and Six-Sigma based Robust design for Aerospace Design project. I am developing applications for mechanical design engineers. I understand there are a few libraries like DAKOTA from sandia national labs that help...

How to create PI sequentially in Ruby..

Out of pure interested, I'm curious how to create PI sequentially so that instead of the number being produced after the outcome of the process, allow the numbers to display as the process itself is being generated. If this is the case, then the number could produce itself, and I could implement garbage collection on previously seen numb...

Non Linear Integer Programming

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. ...

How does this integer encoding work?

In this code golf question, there is a python answer that encodes the lengths of all integers from 1 to 99 in english to a big number: 7886778663788677866389978897746775667552677566755267756675527886778663788677866355644553301220112001 To get the length of n, you just have to calculate 3 + (the_big_number / (10**n)) % 10. How does thi...

How-to: Find a good mathematical algorithm to distribute measuring points over time?

Hi folks. I'm currently implementing a software that measures certain values over time. The user may choose to measure the value 100 times over a duration of 28 days. (Just to give an example) Linear distribution is not a problem, but I am currently trying to get a logarithmical distribution of the points over the time span. The str...

Need help optimizing solution for Project Euler problem #12.

Hey everyone, I've been having my fun with Project Euler challenges again and I've noticed that my solution for number 12 is one of my slowest at ~593.275 ms per runthrough. This is second to my solution for number 10 at ~1254.593 ms per runthrough. All of my other answers take less than 3 ms to run with most well under 1 ms. My Java s...