0
$\begingroup$

I am told to express a fitness function for a question I have been presented. I am unsure how I would express the function. In words, what I have written down makes sense but turning this into a mathematical formula is proving a bit difficult. My understanding is:

The fitness function for this scenario will want to ensure that the best offer for building the computers is chosen whilst the price of the final optimal offer is low.

The fitness function in this case would want to consider a few factors. The first factor is that the quantity of the computer parts was enough that each offers that were returned had a sufficient quantity of parts. Ideally, it would be best if we did not have any duplicates of parts in the offers. The cost is low too, but all parts have been found amongst the different offers that we have.

The fitness function will need to ensure all of this is factored in.

The scenario and question are below:

For the production of a number of laptops, a computer company needs a quantity of each component such as screens (S), hard drives (HD), optical drives (OD), RAM, video cards (VC), CPU, Ports, etc. The company received a number of priced offers. Note that offers do not contain all components. As examples:

  • Offer 1: 1000 RAMs, 800 HDs, 2000 ODs – £75K
  • Offer 2: 1850 S, 1570 OD - £40K
  • Offer 3: 3000 HD, 2000 RAM – £70K
  • Offer 4: 1500 RAM, 2000 VC, 1700 S – £55Ketc.

The company would be interested to accept cheaper offers in the first place. Answer the following: Give the expression of the fitness function.

Any help would be greatly appreciated 😊.

$\endgroup$
0

1 Answer 1

0
$\begingroup$

If we assume that each laptop requires 1 component of each type, so 1 screen, 1 hard drive, 1 RAM, etc. (i.e. the company has no preference for the type of component), then the company, to maximize the number of laptops it can build (which is supposedly the ultimate goal of the company), it should

  1. maximize the number of instances of the least available component in the offer, and

  2. minimize the cost of the offer

So, one possible fitness function would then need to take these 2 objectives into account, so this would be a multi-objective optimization problem.

Recall that a fitness function evaluates individuals in the population. If we assume that the individuals are the offers and the goal would be to find the best offer in the space of offers, then we can devise some fitness function $f$ of the form

$$ f(o) = (1 - \alpha)\frac{1}{1 + p(o)} + \alpha \min(o), \label{1}\tag{1} $$ where

  • $o$ is an offer, so $f(o)$ is the fitness of the offer $o$, i.e. how much it is desirable (i.e. we want the fitness to be high, usually).
  • $p(o)$ is the price/cost of the offer $o$
  • if we assume that $o$ is an array of the form $o = [1000, 800, 2000, \dots]$, where $o_i$ is the number of items of type $i$ (e.g. $i$ is RAM, then $o_i$ would be the number of RAMs in the offer $o$), then $\min(o)$ would be the number associated with the least available item in the offer (e.g. if the indidivudal was $[12, 4, 5]$, then $\min(o) = 4$)
  • $\alpha \in [0, 1]$ is a hyper-parameter that trades off the two objectives (i.e. prices and the smallest number)

The fitness function $f$ in equation \ref{1} will be maximal when $p(o) = 0$ and $\min(o) = N$, where $N$ is some maximum threshold of possible number of items of the same type that an offer can have.

I have just come up with this fitness function. I don't know whether it will work in practice or not, but this is the idea of what you have to do. You can design other similar fitness functions (for example, how would you design a fitness function that takes into account that the number of components of each type should be more or less the same?). You may want to try to implement this e.g. with DEAP and see how it behaves. You probably also want to make sure that $o$ are arrays of integers (and not floating-point numbers). You probably also want to read this answer.

$\endgroup$
0

You must log in to answer this question.