It's Been Pretty Dead Around Here...

It's Been Pretty Dead Around Here...

...so I thought we should get some discussion going. Maybe we can help each other flesh out some ideas and finish that long piece that’s been sitting in your drafts for a while.

Fun Fact: any author can see your unfinished Hackerspace work if you started to compose it for Hackerspace (don’t bother looking, I don’t keep my work in there).

I propose we share whatever we’re struggling with and see if we can get a little bit of group help for it. If anyone wants my opinion, I’m always good for some math. I’m sure each person here has something they’re best at and are willing to lend a hand.

My Problem

So I’m currently working on writing a brute force algorithm to determine the most valuable set of things (I want the actual subject to be a secret until I have it finished). So each thing has two variables, one is a measurable that we want as high as possible and the other is a cost that needs to stay under a certain value.

So consider there are X things we need to choose and Y things to choose from there are yCx (mathematical notation for combination) possibilities. Then each X has value A that we want to be high (or low depending on the desired metric) and a value B that is its cost. Now think of the set of chosen Xs and the sum of their costs (B) must be below a certain level.

It is hard because it isn’t like you want to minimize B, otherwise you could just assign each X one value as an A/B. So I’m trying to figure out a way to write a program to do it for me. I have everything figured out except for the sequence of generating each and every combination and writing it in a way that you can change the number of Xs and Ys without having to write more and more code.

Each variable is in a separate array, but matched by their indexes. I was thinking a for loop but then I realized the way I was doing it would require a new for loop for the number of Xs needed. Any ideas?

What is everyone else working on and how can someone here help?




via Patrick Nichols
Share on Google Plus

About GN

GN (Galeri Nusantara) berusaha memberikan informasi terbaru mengenai berbagai hal yang ada diseluruh nusantara dan dunia dengan akurat dan sumber yang terpercaya.
    Blogger Comment
    Facebook Comment

0 comments :