[Haskell-cafe] Vague: Assembly line process

Alexander Solla ajs at 2piix.com
Mon Jun 14 22:24:12 EDT 2010


On Jun 14, 2010, at 4:40 PM, Luke Palmer wrote:

> So hang on, what is the problem?  You have described something like a
> vague model, but what information are you trying to get?  Say,
> perhaps, a set of possible output lists from a given input list?

I think he's trying to construct a production possibility curve for a  
given set of inputs, and (probably) the most efficient production plan  
given the costs of his inputs.  This is a problem I am going to have  
to solve programmatically, too.  I intend on solving it by finding the  
input in a given category of necessary inputs with the lowest average  
cost per unit.  I'm not concerned about "hard" cost allocation limits  
-- i.e. it's okay for the firm to buy more of an input than might be  
necessary for another output as long as the average unit cost is the  
lowest (since all the inputs will be used eventually anyway).  Hard  
allocation complicates the problem, since you have an upper bound on  
what you can spend, and you want to spend it most effectively,  
presumably with as little "waste" of available cash as possibile.  Bin  
packing.

Martin:  You need to find a nice "normal form" for inputs and  
outputs.  If there aren't going to be many different types  of inputs,  
you can deal with interchangeability by making a type for each type of  
input.  (For example, if you were a jeweler, you could make:)


type Price = Integer  -- In cents, or a suitable denomination
type Quantity = Integer
data Mint   = Perth | CreditSuisse | Sunshine | Kitco deriving (Eq,  
Show)
data Gold   = Gold Mint Quantity Price deriving (Eq, Show)
data Silver = Silver Mint Quantity Price deriving (Eq, Show)

class AverageCost commodity where average_cost_per_unit :: commodity - 
 > Price
instance (AverageCost commodity) => Ord commodity where -- I hope this  
isn't an undecidable instance
	left <= right = (average_cost_per_unit left) <=  
(average_cost_per_unit right)

data UnitOutput = UnitOutput { product :: Product,  requires ::  
Requirement }
data Requirement = Requirement { gold :: Gold, silver :: Silver }
data Product = GoldWatch { style :: ... } | GoldChain { style :: ... }  
| SilverWatch { style :: ... }

etc.  How you encode the style/product/output relationship is up to  
you (maybe products should know their necessary inputs.  Maybe not).   
If you have hard allocation limits, you can use a bin packing strategy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100614/adc60d98/attachment.html


More information about the Haskell-Cafe mailing list