Interface CostModel
- All Known Implementing Classes:
RateCardCostModel
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Prices a portfolio. The one place cost comes from: the cost objective, the budget constraint,
the reports and the deployment plan all read the same
PortfolioCost, so they cannot
disagree. Implementations may call rate cards, and should cache: a solver prices many
portfolios that share metros.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidprepare(Collection<MetroPortfolio> portfolios, DesignContext context) Prices ahead of time whatprice(MetroPortfolio, DesignContext)will need for these portfolios, so later calls answer from memory.price(MetroPortfolio portfolio, DesignContext context)
-
Method Details
-
price
- Parameters:
portfolio- the candidate designcontext- the facts of this run- Returns:
- every priced line with its source and range, and what could not be priced
-
prepare
Prices ahead of time whatprice(MetroPortfolio, DesignContext)will need for these portfolios, so later calls answer from memory. A solver calls it once per run with every portfolio it is about to price (never one a constraint has already rejected). It must not change any result: an implementation may batch or parallelise independent lookups, butprice(MetroPortfolio, DesignContext)must return what it would have returned without it. The default does nothing.- Parameters:
portfolios- the portfolios about to be priced, in a deterministic ordercontext- the facts of this run
-