DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Performance
  4. How to design a good score function for business resource optimization

How to design a good score function for business resource optimization

Geoffrey De Smet user avatar by
Geoffrey De Smet
·
Sep. 03, 12 · Interview
Like (0)
Save
Tweet
Share
4.43K Views

Join the DZone community and get the full member experience.

Join For Free

Drools Planner finds the best solution for any kind of business resource planning problem. But given 2 planning solutions, which one is better for your business? That depends on your business, so Planner needs to be told.

There are several techniques to define your score function. Each of these techniques can be combined with the others. Let's take a look at them:

Maximizing and minimizing constraints

Suppose you want your planning to maximize your apples harvest. In that case, the planning solution which harvests the most usable apples is the optimal solution. Each usable apple adds a score of +1 and the solution with the highest score wins:

Positive and negative constraints

Alternatively, suppose you have a vehicle routing problem and you want to minimize the fuel used to visit all of your customers. As shown in the second example, each fuel usages adds -1 to the score. Still the solution with the highest score wins.

In the examples above, there are only 3 solutions per problem. In reality, there are often more than 10^1000 solutions. Luckily, Planner doesn't evaluate all of them.

Score weighting

You can combine multiple constraints on the same problem. One technique is to weight them against each other. For example, in the vehicle routing problem below, every 1 unhappy driver is as bad for the business as 2 fuel usages:

Score weighting

The score for each solution is the sum of its weighted constraints. Again, the solution with the highest score wins.

Many business problems weight their constraints on its monetary value: they basically put a price tag on every expense and revenue and optimize the solution to maximize profit.

Score levels

Some constraints cannot be broken, because it makes the solution infeasible. Such constraints are often called hard constraints. For example in the vehicle routing problem, an overloaded truck's axle will break and the truck won't reach its destination. So, no amount of fuel usage is worth a broken axle:

Score levels

The solution with the highest score on the first level wins. If that's the same, the solution with the highest score on the second level wins. Since score are naturally compared lexicographically, the solution with the highest score wins.

Most use cases use only 2 score levels: Hard constraints to respect the limits of physical reality or law. Soft constraints to maximize profit and/or employee well being. Planner supports any number of score levels.

Pareto optimization

This rare form of scoring has a intresting paradox.

Suppose you want to maximize your apples and oranges harvest. But you can't compare apples and oranges. You can't put a price tag on them or somehow define their relative worth to you. For a real world example, presume the oranges represent financial gain and the apples represent ecological gain.

Can we optimize such a planning problem? It might look like we can't, because we can't compare those apples and oranges, but in fact, we can optimize a great deal:

Pareto scoring

Since we can't compare apples and oranges, Planner can't decide if solution A or solution B should be used. Both solutions are shown to the user and depending on his preference either A or B is used.

But Planner can discard all the other solutions; because only an idiot would take the solution with 2 apples and 1 orange, regardless of his apples/oranges preference: solution A has more apples and not less oranges, so A dominates the solution with 2 apples and 1 orange. Even if the user prefers oranges it makes no sense to take a solution with less apples if there is no gain in oranges.

Conclusion

By combining these score techniques, we can craft a score function that accuratly and objectively represents the benefits to our business. That allows Drools Planner to generate a very efficient business resource planning for us, which is usually a financial and ecological win-win situation.

Orange (software) optimization Design

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Better Performance and Security by Monitoring Logs, Metrics, and More
  • PostgreSQL: Bulk Loading Data With Node.js and Sequelize
  • OpenID Connect Flows
  • Choosing the Best Cloud Provider for Hosting DevOps Tools

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: