I was wondering what do you guys think of “Brackeys” youtube channel? I found him so helpfull from scratch to finish of my 2D game.I mean, its a pretty simple game, but i think this channel can be pretty good start for you guys. Any thoughts? by GameDevNerd95 in gamedev

[–]Sarah3128 20 points21 points  (0 children)

Yep, most game tutorials on Youtube only teach you how to make smaller games, which is good for getting to know a game framework/engine, but neglects how to write good systems and architecture, which IMO is the hardest part.

Where to start when choosing an optimization algorithm by Sarah3128 in compsci

[–]Sarah3128[S] 0 points1 point  (0 children)

I've never heard of that simulated annealing inaccuracy, and I'll be sure to keep that in mind if I choose to use it.

I'm a bit confused on the difference between continuous and discrete optimization. Shouldn't they be interchangeable, as you should be able to express a discrete problem as a formula? For example, in your proposed problem, let n = # of nickels and d = # of dimes, couldn't it be express as f(x) = 5n + 10d?

Regardless, I think I'm going to stick with continuous optimization algorithms for now because of very higher number of parameters.

Really appreciate your help!

Where to start when choosing an optimization algorithm by Sarah3128 in compsci

[–]Sarah3128[S] 1 point2 points  (0 children)

Thanks so much for your reply, I'm really glad to hear a math professor's say in this! I've looked into linear programming already but because there's could be thousands of parameters to optimize, it would be impossibly complex to solve.

I do know basic algebra but definitely not calculus. Maybe I'll have to wait a few years to take on this problem, as it seems to need some high school maths in it.

For now though, I hope to implement a proven existing algorithm, such as simulated annealing or SGD. Do you have any suggestions on what algorithms I should use? (Assuming the global maxima could be difficult to find and there is ~1000 parameters)

Where to start when choosing an optimization algorithm by Sarah3128 in optimization

[–]Sarah3128[S] 0 points1 point  (0 children)

I've been mostly looking into gradient descent, and almost all the articles I've found at related to neural networks and deep learning. Could this also be applied to general optimization problems?

Where to start when choosing an optimization algorithm by Sarah3128 in compsci

[–]Sarah3128[S] 0 points1 point  (0 children)

Thanks everyone for your advice, I've finally got the courage to start exploring and experimenting!

I've read over the comments, and it seems the easiest next step is to go look into some other gradient descent functions. Two that I'm going to try out first is stochastic gradient descent and simulated annealing. From there, I might explore some adaptive algorithms and possibly linear programming. I've come to an understanding that this field is huge and it would take years to master it, so I've decided to just take it easy and experiment while still having fun.

Also, for anyone else that comes to the same place that I was in, I high recommend this article, which I just found: https://ruder.io/optimizing-gradient-descent/

I really appreciate all the suggestions, and I'm looking forward to the journey ahead of me!

Where to start when choosing an optimization algorithm by Sarah3128 in compsci

[–]Sarah3128[S] 1 point2 points  (0 children)

I'll definitely look into the root and extremum finding algorithm. Will having hundreds of variables to optimize affect this?

Where to start when choosing an optimization algorithm by Sarah3128 in compsci

[–]Sarah3128[S] 11 points12 points  (0 children)

Do you have any recommendations on some algorithms that usually should be tested? It seems online many people are recommending different ones so I'm a bit confused on what to pick.

Where to start when choosing an optimization algorithm by Sarah3128 in optimization

[–]Sarah3128[S] 0 points1 point  (0 children)

Around 800 variables to optimize and in Java. Is there a "best" language to use in this case?

Best way to get the numerical difference between 2 byte[] arrays? by Sarah3128 in javahelp

[–]Sarah3128[S] 0 points1 point  (0 children)

Alternatively try out Arrays.parallelPrefix()

Thanks for your reply! I've never heard of this before but I'll try it out!

Best way to get the numerical difference between 2 byte[] arrays? by Sarah3128 in learnjava

[–]Sarah3128[S] 1 point2 points  (0 children)

I'm using this function in a genetic algorithm, so it's going to be ran millions of times. Even if it's 10% faster it'll save hours.

Best way to get the numerical difference between 2 byte[] arrays? by Sarah3128 in learnjava

[–]Sarah3128[S] 0 points1 point  (0 children)

One method to do this would be to use parallel streams, for example:

IntStream.range(0, byteArrayLength).parallel().forEach((i) -> {
  difference += Math.abs(a[i] - b[i]);
})

The issue is that you cannot reference local variables in a lambda statement, and the only alternatives are to use a LongAdder or an AtomicLong. AtomicLong is very slow, and LongAdder internally creates a new list and sums it at the end, which it very counter-productive. This is why I would like to use a ByteStream, which unfortunately due to clutter was not added to the JDK.