Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Clojure Data Structures and Algorithms Cookbook

You're reading from   Clojure Data Structures and Algorithms Cookbook 25 recipes to deeply understand and implement advanced algorithms in Clojure

Arrow left icon
Product type Paperback
Published in Aug 2015
Publisher
ISBN-13 9781785281457
Length 216 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Rafik Naccache Rafik Naccache
Author Profile Icon Rafik Naccache
Rafik Naccache
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Revisiting Arrays FREE CHAPTER 2. Alternative Linked Lists 3. Walking Down Forests of Data 4. Making Decisions with the Help of Science 5. Programming with Logic 6. Sharing by Communicating 7. Transformations as First-class Citizens Index

Resolving cost and profit optimization problems

For this recipe, we will study optimization problems. For these, you are given a set of constraints on some variables, say:

4x+3y < 30
2x+4y < 10

You are then asked to maximize or minimize a function of these variables, (if constraints are inferior, then you'll have to maximize and vice versa), for example:

max(z=13 x + 7 y)

This is called the objective function. Generally speaking, such problems are called linear programs, and the algorithm used for resolving these is called the simplex algorithm.

However, the simplex algorithm operates on real variables, that is, the variables that take real values. This is problematic if the solution to the problem can only be a compound of natural numbers. For instance, let's assume that some bakery calls you to help them optimize their profit. They tell you that they produce three kinds of products: bread, croissants, and muffins. The bread takes 2 units of sugar and 4 units of flour, the croissant...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image