Stability of Extreme Point Solution - optimization

Suppose I know the solution to the problem:
max f(x)
s.t x in conv{a1, a2, ..., an}
where f is a convex function. It is well known that an optimal solution to this problem lies on one of the extreme points of the convex hull of {a1, a2, ..., an}.
My question is the following. Suppose I pertub the convex hull with the following perubation:
ak <- ak + c.
What would be the demands on c and f so that the optimal extreme point solution (w.r.t the order of the ai) does not change? In other words, when changing the constraints by a bit I don't want the solution to jump off to a completely different place and would expect it to stay.

Related

Graph Between Steiner Tree and Complete Graph

Given a set points P in the plane, and given a threshold t, I'd like to compute a connected graph G to minimize the sum of the lengths of its edges, subject to the following constraints:
The vertices of G contain all the points in P.
For every pair of points u and v in P, their distance in G is no greater than t times their Euclidean distance.
When t=1, this problem is solved by constructing a complete graph on P. When t is infinite (or simply large enough), this problem is the Euclidean Steiner Tree Problem.
If there already a name for this problem, I'm curious what it is. More than that, does anyone have any suggestions for how to make an algorithm for this? Since it contains the Euclidean Steiner Tree Problem as a special case, it can't be simpler, so I'm not looking for anything particularly time efficient. Thanks!

finding pivot point of two 3D transformations

I need to find out what the degrees of freedom are between two arbitrary geometries that may be linked to eachother. for instance a hinge consisting of two parts. I can simulate the motion of the two parts, and I figured that if I fix one of the parts in place, i can deduce what the axes and point of rotation is for the second moving part is from the transformation in each timestep.
I run into some difficulties calculating this (my vector algebra is ok, my (numpy) math skills less so)
How I see it is I have two 4x4 transformation matrices for each timestep, the previous position/orientation of the moving part (A) and the current position/orientation (A')
then the point of rotation can be found by by calculating the transformation matrix B that transforms A into A' which is I believe
B = inverse(A) * A'
and then find the point that does not change under transformation by B:
x = Bx
Is my thinking correct and if so, how do I solve this equation?

Convexity of function and its optimization

Is function convex in x and y jointly? I want is to estimate both parameter x and y, that minimizes the least square. If the function is convex in both x and y jointly, then technically I can find x and y by iterating between 2 steps: Find best x given y and find best y given x.
Obviously I know I might be wrong in multiple levels. Function look non-convex as there a multiple saddle point ie. all x=0 and y=0. But if I have a constrain that y>0, this problem is no longer there.
Further, I am not sure whether the iterative algorithm work and converge even if the function is convex.
You can compute Hessian and check whether it is positive definite.
A convex optimization problem is defined to have convex objective, convex inequality constraints, and affine equality constraints. As you've pointed out, your objective is not convex therefore is not a convex optimization problem. This problem also seems underspecified. Why not just solve the problem minimize sum_i (a_i - alpha* b_i)^2 over alpha? This problem is convex in alpha of course and once you've found alpha, you can go ahead and choose any x and y such that x*y = alpha, though I admit it's not clear why you'd want to do this

Not a knapsack or bin algorithm

I need to find a combination of rectangles that will maximize the use of the area of a circle. The difference between my situation and the classic problems is I have a set of rectangles I CAN use, and a subset of those rectangles I MUST use.
By way of an analogy: Think of an end of a log and list of board sizes. I can cut 2x4s, 2x6s and 2x8s and 2x10 from a log but I must cut at least two 2x4s and one 2x8.
As I understand it, my particular variation is mildly different than other packing optimizations. Thanks in advance for any insight on how I might adapt existing algorithms to solve this problem.
NCDiesel
This is actually a pretty hard problem, even with squares instead of rectangles.
Here's an idea. Approach it as an knapsack-Integer-Program, which can give you some insights into the solution. (By definition it won't give you the optimal solution.)
IP Formulation Heuristic
Say you have a total of n rectangles, r1, r2, r3, ..., rn
Let the area of each rectangle be a1, a2, a3, ..., an
Let the area of the large circle you are given be *A*
Decision Variable
Xi = 1 if rectangle i is selected. 0 otherwise.
Objective
Minimize [A - Sum_over_i (ai * Xi)]
Subject to:
Sum_over_i (ai x Xi) <= A # Area_limit constraint
Xk = 1 for each rectangle k that has to be selected
You can solve this using any solver.
Now, the reason this is a heuristic is that this solution totally ignores the arrangement of the rectangles inside the circle. It also ends up "cutting" rectangles into smaller pieces to fit inside the circle. (That is why the Area_limit constraint is a weak bound.)
Relevant Reference
This Math SE question addresses the "classic" version of it.
And you can look at the link provided as comments in there, for several clever solutions involving squares of the same size packed inside a circle.

Resolution independent cubic bezier drawing on GPU (Blinn/Loop)

Based on the following resources, I have been trying to get resolution independent cubic bezier rendering on the GPU to work:
GPU Gems 3 Chapter 25
Curvy Blues
Resolution Independent Curve Rendering using Programmable Graphics Hardware
But as stated in the Curvy Blues website, there are errors in the documents on the other two websites. Curvy Blues tells me to look at the comments, but I don't seem to be able to find those comments. Another forum somewhere tells me the same, I don't remember what that forum was. But there is definitely something I am missing.
Anyway, I have tried to regenerate what is happening and I fail to understand the part where the discriminant is calculated from the determinants of a combination of transformed coordinates.
So I have the original coordinates, I stick them in a 4x4 matrix, transform this matrix with the M3-matrix and get the C-matrix.
Then I create 3x3 matrices from the coordinates in the C-matrix and calculate the determinants, which then can be combined to create the a, b and c of the quadratic equation that will help me find the roots.
Problem is, when I do it exactly like that: the discriminant is incorrect. I clearly put in coordinates for a serpentine (a symmetric one, but a correct serpentine), but it states it is a cusp.
When I calculate it myself using wxMaxima, deriving to 1st and 2nd order and then calculating the cross-product, simplifying to a quadratic equation, the discriminant of that equation seems to be correct when I put in the same coordinates.
When I force the code to use my own discriminant to determine if it's a serpentine or not, but I use the determinants to calculate the further k,l,m texture coordinates, the result is also incorrect.
So I presume there must be an error in the determinants.
Can anyone help me get this right?
I think I have managed to solve it. The results are near to perfect (sometimes inverted, but that's probably a different problem).
This is where I went wrong, and I hope I can help other people to not waste all the time I have wasted searching this.
I have based my code on the blinn-phong document.
I had coordinates b0, b1, b2, b3. I used to view them as 2D coordinates with a w, but I have changed this view, and this solved the problem. By viewing them as 3D coordinates with z = 0, and making them homogenous 4D coordinates for transformation (w = 1), the solution arrived.
By calculating the C matrix: C = M3 * B, I got these new coordinates.
When calculating the determinants d0, d1, d2, d3, I used to take the x, y coordinates from columns 0 and 1 in the C matrix, and the w factor from column 2. WRONG! When you think of it, the coordinates are actually 3D coordinates, so, for the w-factors, one should take column 3 and ignore column 2.
This gave me correct determinants, resulting in a discriminant that was able to sort out what type of curve I was handling.
But beware, what made my search even longer was the fact that I assumed that when it is visibly a serpentine, the result of the discriminant should always be > 0 (serpentine).
But this is not always the case, when you have a mathematically perfect sepentine (coordinates are so that the mean is exact middle), the determinant will say it's a cusp (determinant = 0). I used to think that this result was wrong, but it isn't. So don't be fooled by this.
The book GPU Gem 3 has a mistake here, and the page on nVidia's website has the mistake too:
a3 = b2 * (b1 x b1)
It's actually a3 = b2 * (b1 x b0).
There're other problems about this algorithm: the exp part of the floating point will overflow during the calculation, so you should be cautious and add normalize operations into your code.