Industrial Engineer

You can talk about anything here

Moderator: Global Moderator

User avatar
Wetmelon
Honorary Member
Honorary Member
Posts: 190
Joined: Wed Sep 10, 2008 8:49 am
Location: London, ON

Industrial Engineer

Post by Wetmelon »

Looking for the clan member(s) who is an industrial engineer... I have a question about resource management :/
cheesehat

Re: Industrial Engineer

Post by cheesehat »

Depends on which civ you're playing :P
User avatar
Hydrovert5
Honorary Member
Honorary Member
Posts: 627
Joined: Sat Jan 05, 2008 4:11 am
Location: Newcastle, United Kingdom

Re: Industrial Engineer

Post by Hydrovert5 »

[quote=""cheesehat""]Depends on which civ you're playing :P[/quote]

Rofl!

Jarod is an industrial engineer as far as I know. (Soccerman771)

:)
User avatar
Soccerman771
N3O Officer
N3O Officer
Posts: 2874
Joined: Fri Jan 18, 2008 7:25 am
Location: Sachse, Texas (near Dallas)
Contact:

Re: Industrial Engineer

Post by Soccerman771 »

I sure is. Wanna send me a PM?
jtackel@hotmail.com

"Do you know how difficult it is to micro Napalm?" - Lazy_Tuga

"This isn't going to work. I've picked a water deck and there isn't even a pond on this map." - Blackadderthe4th
User avatar
Wetmelon
Honorary Member
Honorary Member
Posts: 190
Joined: Wed Sep 10, 2008 8:49 am
Location: London, ON

Re: Industrial Engineer

Post by Wetmelon »

[quote=""cheesehat""]Depends on which civ you're playing :P[/quote]

ROFLUMHE!
User avatar
Royal_Guard
Private
Private
Posts: 35
Joined: Mon Sep 08, 2008 1:01 am
Location: Florida

Re: Industrial Engineer

Post by Royal_Guard »

[quote=""cheesehat""]Depends on which civ you're playing :P[/quote]
that gave me a good laugh
Last edited by Royal_Guard on Sun Mar 29, 2009 2:33 am, edited 1 time in total.
"In the end of the day, as long as there are still two people left in the world, someone is going to want someone dead."
wicked_assassin
N3O Member
N3O Member
Posts: 668
Joined: Sun Jan 11, 2009 11:27 pm
Location: Belgium

Re: Industrial Engineer

Post by wicked_assassin »

my father is (still living at home btw :? ) ... i can ask....
Image
User avatar
IndyBrit
N3O Officer
N3O Officer
Posts: 1318
Joined: Tue Feb 05, 2008 1:53 am
Location: Indianapolis

Re: Industrial Engineer

Post by IndyBrit »

Soccer is your man. I can probably help too, if you want a second opinion.
User avatar
Wetmelon
Honorary Member
Honorary Member
Posts: 190
Joined: Wed Sep 10, 2008 8:49 am
Location: London, ON

Re: Industrial Engineer

Post by Wetmelon »

My problem stems from this spreadsheet:
http://webpages.charter.net/wetmelon/fi ... l_Wars.xls

I want to know how to calculate the proper mixture of any two or more chosen units to optimize the resource usage. I.e. I don't want 1700 iron just sitting there not being used while my spearmen are being built because I ran out of wood...

I understand optimization when using a single bottleneck (You have 1500ft of fencing, and are building a fenced in area with one side created by the river... etc) but I'm not sure how to do it with 2 or more limiters (Wood for the Spearmen, Iron for the Swordsmen)...

Any help? I have my calculus book in front of me to refer to if you want me to research anything :P
User avatar
IndyBrit
N3O Officer
N3O Officer
Posts: 1318
Joined: Tue Feb 05, 2008 1:53 am
Location: Indianapolis

Re: Industrial Engineer

Post by IndyBrit »

OK:
Assuming that all unused resources are equally "bad" (ie extra iron is just as bad as extra wood), with 2 units the optimal is easy. Assign a ratio between the two units (start at a nominal 50/50 maybe - can go by either unit count or population), and test a slightly higher and slightly lower ratio. Keep going in the direction of improvement, and when you see a reversal go back. You can converge quickly by taking large initial steps and then taking smaller steps as you zoom in on the goal. E.g. - start with 50/50, then test 25/75 and 75/25. Take the best result (say 75/25) then test 13/87 and 37/63. Etc. The visual basic code to converge on best conditions for two units is trivial. (Also, you could make certain resources "worse", like an unused iron is 1.5 unused wood, etc., which simply affects your solution equation).

KK - 3 or more. Now it gets a little tricky. One simple way to do this is to test a good bit of the unit-space, which will get you close to a local optimum very quickly. However, if you have a high non-linearity in your solution space you may miss it. Example, with units A,B,C you could try every 10% possibility very rapidly (just cycle through each of ABC at 10-90 (include 0 & 100 if allowed)) which is I think 1000 points. Then, test the best one at a finer resolution around that point (if 10/60/30 was the best, maybe try every couple of percentage points around that). This will give you a quick local optimum that in a relatively linear system will be close to the overall optimum. You could check the derivative of the solution equation around each of your points if you were truly worried about missing a fine local optimum, as the derivative of the solution equation will generally be relatively high near a singularity.

The code to implement 3 or more as described is relatively simple as well, although the run-time could get excessive if you wanted to check finer resolution (e.g. at 5% ratio you have about 20^3 or 8,000 initial points to check). You can also see that adding more units exponentially increases the solution space (at 5 units and 10% ratio, you have 10^5 checks).

Finally, you could build in some intelligence to make a better initial guess. You have an nxm matrix where you always have 4 equations (sum=wood, sum=clay, sum=iron, and sum=pop). The problem is that you are overspecified for less than 4 unknowns (e.g. only 2 or 3 units selected) and you have too little information for 5 or more. So if my head is screwed on straight here, you can probably set up an algorithm to make an initial guess toward the correct answer (e.g. looking to see if a unit sub-set uses compatible percentages of the total resources), and in some circumstances you may be able to solve the matrix outright for the optimal solution without iteration (e.g. where a simple ratio of the units consumes the resources exactly in a fraction of the total, and I think maybe where you have exactly 4 units).

That is, if I understand your problem. :-P
cheesehat

Re: Industrial Engineer

Post by cheesehat »

[quote=""Wetmelon""]My problem stems from this spreadsheet:
http://webpages.charter.net/wetmelon/fi ... l_Wars.xls

I want to know how to calculate the proper mixture of any two or more chosen units to optimize the resource usage. I.e. I don't want 1700 iron just sitting there not being used while my spearmen are being built because I ran out of wood...

I understand optimization when using a single bottleneck (You have 1500ft of fencing, and are building a fenced in area with one side created by the river... etc) but I'm not sure how to do it with 2 or more limiters (Wood for the Spearmen, Iron for the Swordsmen)...

Any help? I have my calculus book in front of me to refer to if you want me to research anything :P[/quote]

Wait...you ARE playing TribalWars :P
User avatar
Wetmelon
Honorary Member
Honorary Member
Posts: 190
Joined: Wed Sep 10, 2008 8:49 am
Location: London, ON

Re: Industrial Engineer

Post by Wetmelon »

[quote=""IndyBrit""]That is, if I understand your problem.[/quote]

You certainly do! However, I would prefer not to attack it with brute force programming, and I only know how to program in Java and HTML, and HTML won't help for calculations like this, and Java I don't know how to implement in an Excel spreadsheet sooo... A stricter formula would be much simpler at this point than implementing a "guess-and-check" method (which, in truth, when evaluated at a fine resolution, would be quite accurate)l.

Also, It only needs to be accurate within the greatest possible divisor. I.e. if I have 69 iron left over, then I can't build .9857142857 of a swordsmen. This lack of required accuracy would, I'm sure, create a much faster program, but again; I don't have the required mathematical knowledge to write this program: I'm a senior in high school xD.
User avatar
IndyBrit
N3O Officer
N3O Officer
Posts: 1318
Joined: Tue Feb 05, 2008 1:53 am
Location: Indianapolis

Re: Industrial Engineer

Post by IndyBrit »

OK,
So I built a spreadsheet that calculates an error term based on resources unused, and let Solver select how many of each unit (with a zero or one in a field to turn units on or off). It works marginally well, but the problem was that Solver is too stupid for this and jumps to the nearest local minimum, giving a different answer each time that I gave it a different initial starting condition.

I think I can build a smarter error function by optimizing a troop mix that approximates the resource mix. That error definition may be more robust to the local minimum problem.

I came across a question for you - are all unused resources the same? Don't you actually want to maximize attack power fielded or some such thing? It seems that 1000 unused population might be worse that 1000 unused wood, but I didn't have a way to define that. Perhaps all resources should be used in the same fraction as the totals? E.g. - 1600 POP is weighted the same as 6000 Wood, or unused pop is 6/1.6 times worse.

If you can program Java and HTML, you can program visual basic, which is included with Excel. I know you want to avoid programming, but it is a powerful tool you should get to know. I could code up a nice solution to this in about 20 minutes that would be WAY smarter than Solver.

I'll look at it some more if want with the improved error function - just let me know by responding to this.
User avatar
Wetmelon
Honorary Member
Honorary Member
Posts: 190
Joined: Wed Sep 10, 2008 8:49 am
Location: London, ON

Re: Industrial Engineer

Post by Wetmelon »

[quote=""IndyBrit""]I came across a question for you - are all unused resources the same? Don't you actually want to maximize attack power fielded or some such thing? It seems that 1000 unused population might be worse that 1000 unused wood, but I didn't have a way to define that. Perhaps all resources should be used in the same fraction as the totals? E.g. - 1600 POP is weighted the same as 6000 Wood, or unused pop is 6/1.6 times worse.[/quote]

Why don't you take a look at this: It will tell you a lot...

http://www.mymathforum.com/viewtopic.php?f=15&t=7190
User avatar
Kaiser_von_Nuben
Honorary Member
Honorary Member
Posts: 2186
Joined: Fri Jul 04, 2008 11:40 pm
Location: New York, NY USA

Re: Industrial Engineer

Post by Kaiser_von_Nuben »

Arrgh, my liberal arts brain has been reduced to mush!
"The German Army will not stand for it!"

-Colonel Bockner, King Solomon's Mines (1985)
Post Reply