Business

How to use IT and “Linear Programming” to please your partner!

Posted on

Linear programming has commonly been used in optimisation for a long time, especially in production, investment and transport problems. However it doesn’t need to be boring all the time and it can be used to improve your personal life.

In this example we are going to plan our anniversary and try to get the best out of our money (high benefit is very goooood!).

You have thought about possible presents and activities that you could prepare and with some of your friends help you came up with this table.

You have thought about buying Flowers and Chocolates, organising a trip, have a nice dinner and maybe going to the cinema or the opera. However, you don’t have unlimited resources, you only have $500 and the next release is coming up and you can only have 6h to organise everything without her suspecting something.

low budget

high budget

package

cost

prep. time

benefit

package

cost

prep. Time

benefit

Flowers

1 Rose (F1)

$4

1h

5

12 Roses (F2)

$40

1h

8

Chocolates

8 Pack (C1)

$5

0.5h

5

24 Pack (C2)

$16

0.5h

7

Trip

daytrip (T1)

$65

1.5h

12

weekend (T2)

$250

4h

30

Art & Culture

Cinema (A1)

$20

0.25h

3

Opera (A2)

$180

1h

20

Dinner

Normal (D1)

$50

0.5h

8

Upper class (D2)

$120

0.5h

10

Additionally you don’t want to double up in the type of present because it doesn’t make sense buying a small and a large box of chocolates (at most 1 of the presents of each type)

Then, the big question. How can I improve the benefit with these restrictions?

/* ——— Objective function – Maximise Benefit ————-*/

max: 5 F1 + 8 F2 + 5 C1 + 7 C2 + 12 T1 + 30 T2 + 3 A1 + 20 A2 + 8 D1 + 10 D2;

/* ————- Restrictions —————-*/

// Limited budget (We only have $500)

4 F1 + 40 F2 + 5 C1 + 16 C2 + 65 T1 + 250 T2 + 20 A1 + 180 A2 + 50 D1 + 120 D2 <= 500;

// Limited the preparation time (We only have 6h to prepare it)

1 F1 + 1 F2 + 0.5 C1 + 0.5 C2 + 1.5 T1 + 4 T2 + 0.25 A1 + 1 A2 + 0.5 D1 + 0.5 D2 <= 6;

// Only get one of the same category products

F1 + F2 <= 1;

C1 + C2 <= 1;

T1 + T2 <= 1;

A1 + A2 <= 1;

D1 + D2 <= 1;

// The values are integers because we can’t buy ½ Opera for instance (0 or 1)

int F1,F2,C1,C2,T1,T2,A1,A2,D1,D2;

Note:

To solve this problem you can use one of the several products in the market. I have used lpsolve, a free option with LGPL license (there is a GNU package as well). You can also use the Excel solver; however you need to transform the problem into an Excel Spreadsheet.

Once the problem is solved we get that to get the maximum benefit we need to get: A2 (Opera), C2 (Big chocolates), D1 (small dinner) and T2 (a weekend) with a benefit of 65 and a total cost of $496. This will take you 6h to organise.

But we haven’t finished yet. Let’s do a bit of pos analysis:

Notice that we have $4 left so there is still some possible gain that we could get. Our benefit has been restricted by the time we can spend organising the surprise.

What if I could squeeze 0.5 hour more?

Well then, the optimal solution would become: A2, C2, T2 and F2 to achieve the same benefit, 65. However, if we have a look at the total cost, we would save money only $486 for the same benefit.

And, if we can add half an hour more and make it 7?

Now the solution would be: A2, C2, D1, T2 and F1 with a total benefit of 70 and a cost of $500.

This optimisation approach and post analysis can be used for a number of problems

-Restriction 1: limited by your imagination

-Restriction 2: limited by the time your partner lets you spend investigating J

Have fun!

Successful Consultingware

Posted on

From time to time I have a look at the Blogs that some of my colleagues have. Unless I’m looking for a quick solution to a “why the hell does this thing fail?” or “how the hell do I do that?”, I find a lot more interesting reading to people that I know than people that I don’t. I have been on the same boat and I exactly know what they’re talking about.

I’ve just read Scott’s blog about Consultingware (read here). Scott is a colleague that has been recently been working with me. He is a brilliant developer and consultant (and he seems to be a very good tango dancer as well)

In his post he talks about a model of business that has become very common in recent days and that it could be resumed as:

1. Company A develops a solution that it’s intended to reach a large market

2. Company B sees the product and thinks that it’s a good product that fulfills the 80% of their needs and with a little customisation it would be the perfect product for them because:

a. Buying the product will greatly reduce how long it’ll take to have something working

b. There is a company that will be upgrading the product and liable for any errors or legal problems due to wrong calculations

c. It’s outsourced (easily budgeted and a TAX-friendly cost)

d. And the most important of all is that it’ll cost just about the same amount of money

3. Company A can make money from company B by selling the product and customizing it with the 20% of the missing features. Additionally the new features can be used to increase the product value that will be sold to the other companies.

In my career I’ve been working in this type of scenario several times with a different approach each of the times. They all were very large and complex products and all in financial areas (where the money really is).

· The first of them had an international product. I was involved in the development of the version 4 which it was a full rebuild of the product from scratch (something not very common).

Their approach was: They had the product and it was customised with a set of rules or predicates that were introduced in the system as normal data. Then, the engine used these rules to cater for the specific way of working the clients had.

The product came with a standard set of rules that the client could modify, but realistically they wouldn’t be able to do it because of the complexity. However, they could outsource it to external consultancy companies (as KPMG or PWC to say some) that had specialised consultants to do it.

Then, the company that was making the software wasn’t liable for the customisation even though they had ongoing consulting benefits for training and support and they benefited from the clients that were brought from these third party consultancy companies.

Very little changes or enhancements where made to the software due to client requirements and the ones that were accepted had been evaluated as generic and as beneficial for all the clients (I have to recognise that some clients were heard more than others and their changes were always more generic). As there were no real client specific customisations, no per-client maintenance was required.

· The second case was as well an international product that went to its 6th version.

This product was similarly based in a highly configurable platform in where the company included with the product a basic set of product customisations that were good enough for the majority of the clients and the clients only needed to provide the system with the input values specific to them and the system would calculate the output (after sometimes overnight processing).

As the Product could be adapted to the client needs using an included modelling tool, the clients could create their customisations (or pay my company to do it) and save them to be used whenever it was required. The main difference in the approach of this solution was that the features that were demanded by clients were implemented as features in the modelling tool so the customisations were allowed to be done by the client. This linked with the fact that the client had the chance to use plain C++ to create custom functions (all edited, compiled and linked in the modelling tool) and use them in the different areas of the calculations.

To have a better understanding of the whole, think about Excel. In Excel you can use all the features and if you want to do something else you don’t call Microsoft, you create your scripts and add them to your spreadsheet.

This approach allowed the clients to customise the system to their necessities and the vendor could still offer customisation services without modifying the base code. The downfall was that it was very difficult test the models and verify if the problem was in the model or the customisations. However, there was only one solution for all the clients.

· The third case it’s more related to what Scott was talking about (read here).

Scott, in his conclusion he doesn’t give a solution but I’m going to give my opinion in how I would approach the problem.

Have a look at all the Microsoft and Adobe applications. They all provide an API to create extensions or plug-ins and macros. The product remains the same but you are able to do some customisations to adapt it to your needs. I think that this model would solve most of the problems that Scott talks about. I’m not saying that create a system that supports this model it’s an easy task and it may require a fair bit of thinking, but it would dramatically increase the chances of success, specially because the complexity of the management is reduced not having to keep one branch per customer and each of the modules can be independently tested without affecting the rest of the system.

Good luck in Argentina, Scott!