Click here to Skip to main content
15,889,281 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Start with a group of size X, divide it into Y groups, Z times, minimize overlap Pin
Stefan_Lang27-Aug-18 0:25
Stefan_Lang27-Aug-18 0:25 
AnswerRe: Start with a group of size X, divide it into Y groups, Z times, minimize overlap Pin
Patrice T1-Sep-18 16:42
mvePatrice T1-Sep-18 16:42 
QuestionSimplex Downhill... Pin
User 110609793-Aug-18 9:35
User 110609793-Aug-18 9:35 
AnswerRe: Simplex Downhill... Pin
Stefan_Lang5-Aug-18 21:33
Stefan_Lang5-Aug-18 21:33 
GeneralRe: Simplex Downhill... Pin
User 110609796-Aug-18 4:47
User 110609796-Aug-18 4:47 
GeneralRe: Simplex Downhill... Pin
Stefan_Lang7-Aug-18 2:21
Stefan_Lang7-Aug-18 2:21 
GeneralRe: Simplex Downhill... Pin
User 110609797-Aug-18 21:23
User 110609797-Aug-18 21:23 
GeneralRe: Simplex Downhill... Pin
Stefan_Lang7-Aug-18 22:05
Stefan_Lang7-Aug-18 22:05 
Building on my previous explanations, I realized that the solution may in fact be rather easy to find. the only possible complication is that the global minimum may not lie within the required ranges for w and c. In that case the solution would lie somewhere on the boundary of the parameter space.

The algorithm will work like this: since you want to find the minimum for the norm of the function g, an equivalent task would be to find the minimum for the squared norm of g! Therefore the target function to minimize is:
h(w,c) = square(norm(g(w,c))) = g(w,c)*g(w,c) = (w*b + A*c - t)*(w*b + A*c - t)


A necessary condition for the minimum is that all partial derivatives are 0:
dh/dw = dh/dc1 = dh/dc2 = dh/dc3 = dh/dc4 = 0

This gets you:
dh/dw = 2*(w*b + A*c - t)*b = 0
dh/dci = 2*(w*b + A*c - t)*Ai = 0
, where Ai is the i'th column of A, and i = 1, 2, 3, or 4

These are five linear equations in w, c1, c2, c3, and c4, that can be solved easily with a linear equation solver.

Once you have the solution to this LES, you will have to verify that the solution is actually a minimum and not a maximum, and that the constraints for the parameters are fulfilled. If this is not the case, the solution must be at the boundary of the constrained parameter space, i. e. one or more of the parameters must be fixed at a limit of their valid range. This means you can only use the linear equations above for the partial derivatives of the other variables, leaving you with a LES of 4 or less variables that can also be solved easily.

The only problem here is the complexity of searching each part of the boundary: if there were three restricted parameters, and the restricted range would describe a 3d cube, you'd have to search each of the sides, and each of the edges, and each of the corners of the parameter cube for a local minimum, and then you'd have to compare all minima you've found to find the global minimum. Since you have 5 variables, it gets a lot more complex than that...
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

GeneralRe: Simplex Downhill... Pin
User 110609798-Aug-18 1:41
User 110609798-Aug-18 1:41 
GeneralRe: Simplex Downhill... Pin
Stefan_Lang8-Aug-18 2:11
Stefan_Lang8-Aug-18 2:11 
GeneralRe: Simplex Downhill... Pin
User 110609798-Aug-18 10:18
User 110609798-Aug-18 10:18 
Questionhelp me~ for use..... #define macro ## #@ # Pin
dsyoon ds29-Jul-18 17:07
dsyoon ds29-Jul-18 17:07 
AnswerRe: help me~ for use..... #define macro ## #@ # Pin
Daniel Pfeffer29-Jul-18 20:42
professionalDaniel Pfeffer29-Jul-18 20:42 
AnswerRe: help me~ for use..... #define macro ## #@ # Pin
Richard MacCutchan29-Jul-18 21:26
mveRichard MacCutchan29-Jul-18 21:26 
AnswerRe: help me~ for use..... #define macro ## #@ # Pin
Chris Losinger30-Jul-18 8:32
professionalChris Losinger30-Jul-18 8:32 
QuestionRead text from a file and realloc when needed Pin
claymorehack6-Jul-18 4:02
claymorehack6-Jul-18 4:02 
AnswerRe: Read text from a file and realloc when needed Pin
Richard MacCutchan6-Jul-18 4:08
mveRichard MacCutchan6-Jul-18 4:08 
GeneralRe: Read text from a file and realloc when needed Pin
claymorehack7-Jul-18 22:46
claymorehack7-Jul-18 22:46 
GeneralRe: Read text from a file and realloc when needed Pin
Richard MacCutchan8-Jul-18 2:49
mveRichard MacCutchan8-Jul-18 2:49 
QuestionLookup table with angles Pin
cristiapi6-Jul-18 2:30
cristiapi6-Jul-18 2:30 
AnswerRe: Lookup table with angles Pin
Stefan_Lang5-Aug-18 23:09
Stefan_Lang5-Aug-18 23:09 
QuestionBig-O Notation Pin
Manish16927-Jun-18 18:31
Manish16927-Jun-18 18:31 
AnswerRe: Big-O Notation Pin
Richard Andrew x648-Jul-18 3:33
professionalRichard Andrew x648-Jul-18 3:33 
QuestionTime complexity Pin
Manish16927-Jun-18 1:42
Manish16927-Jun-18 1:42 
AnswerRe: Time complexity Pin
Richard MacCutchan27-Jun-18 2:28
mveRichard MacCutchan27-Jun-18 2:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.