Matthew Crews
https://matthewcrews.com/
Recent content on Matthew CrewsHugo -- gohugo.ioWed, 03 Feb 2021 00:00:00 +0000Scheduling Jobs for Maximum Efficiency - Part 3
https://matthewcrews.com/blog/2021/01/2021-02-04/
Wed, 03 Feb 2021 00:00:00 +0000https://matthewcrews.com/blog/2021/01/2021-02-04/I’ve continued to consult with my friend on the job assignments problem that I have been discussing in post 1 and post 2. At first, he was excited about what we had come up with but I knew there were likely more complexities that had not been uncovered yet. He went back to the client and came away with some new information. He told me, “Mathew, it turns out that machines have limited capacity.Scheduling Jobs for Maximum Efficiency - Part 2
https://matthewcrews.com/blog/2021/01/2021-01-28/
Thu, 28 Jan 2021 00:00:00 +0000https://matthewcrews.com/blog/2021/01/2021-01-28/In my previous post I introduced a scheduling problem where I needed to assign jobs to machines to achieve the maximum efficiency. We say efficiency is calculated as the number of times a machine must change the job-type it is working on. I want to continue exploring this problem by adding some nuance.
Note: Full code for this post can be found here
Not Too Many Bad Jobs As my conversation continued with my friend regarding this problem a new constraint came up.Scheduling Jobs for Maximum Efficiency - Part 1
https://matthewcrews.com/blog/2021/01/2021-01-25/
Mon, 25 Jan 2021 00:00:00 +0000https://matthewcrews.com/blog/2021/01/2021-01-25/I was recently having a discussion with a friend when they brought up a new problem they were looking into. He asked me if it was a good candidate for Mathematical Planning and I said, “Absolutely!” I am abstracting away the specific domain, but this is the essence of the problem.
There are a set of machines which can process jobs. The jobs are of different types and sizes.Minimizing Waste for the Cutting Stock Problem
https://matthewcrews.com/blog/2021/01/2021-01-11/
Mon, 11 Jan 2021 00:00:00 +0000https://matthewcrews.com/blog/2021/01/2021-01-11/I was recently posed the question, “Can you use Mathematical Planning to optimize the Cutting Stock problem?” For those who are not familiar with this problem, you can find the Wikipedia article here. In summary, you have a stock size of paper material from which you need to produce smaller sizes. In the example provided on Wikipedia, the stock size is 5600mm. You are asked to produce a variety of sizes between 1380mm and 2200mm.Learning Resources for F#
https://matthewcrews.com/blog/2021/01/2021-01-09/
Sat, 09 Jan 2021 00:00:00 +0000https://matthewcrews.com/blog/2021/01/2021-01-09/One of the questions that I get quite a bit is, “How did you learn F#?” I keep getting this question, so I decided to write a short post where I laid out what I have found to be the most useful resources to develop my F# skills.
Practice This first piece of advice that I give to people is to choose an algorithm they already know and write it in F#.Maximizing Profitability of Inventory with Mathematical Planning and Machine Learning in F# - Part 3
https://matthewcrews.com/blog/2021/01/2020-01-01/
Fri, 01 Jan 2021 00:00:00 +0000https://matthewcrews.com/blog/2021/01/2020-01-01/In the previous two posts in this series we introduced the Food Cart Problem. We want a plan for stocking our Food Cart which will maximizes our revenue. In the first post we discussed the foods that we can stock and the restrictions we are operating under. We introduced a simple heuristic for stocking the food cart and created a simulation in order to validate what our expected revenue is.Maximizing Profitability of Inventory with Mathematical Planning and Machine Learning in F# - Part 2
https://matthewcrews.com/blog/2020/12/2020-12-21/
Mon, 21 Dec 2020 00:00:00 +0000https://matthewcrews.com/blog/2020/12/2020-12-21/In a previous post we discussed the problem of stocking our food cart to maximize our profitability. We created a simple heuristic and then performed simulations to evaluate the expected profitability. We discussed that knowing the expected profitability was not enough, we calculated Confidence Intervals to understand the where the true expected profitability lies. This week we want to find a better plan for packing the food cart. We will use Mathematical Planning to find an answer which maximize the expected profitability which outperforms the heuristic used in the first post.Maximizing Profitability of Inventory with Mathematical Planning and Machine Learning in F# - Part 1
https://matthewcrews.com/blog/2020/12/2020-12-14/
Mon, 14 Dec 2020 00:00:00 +0000https://matthewcrews.com/blog/2020/12/2020-12-14/One of the questions that I love to answer is, “What is the difference between Mathematical Planning and Machine Learning?” This is an excellent question. The fields are close to one another and solutions often involve both techniques. The way I differentiate is based on what question they are meant to answer. Mathematical Planning is primarily concerned with answering the question, “What should we do?” Machine Learning answers the question, “What is most likely?Why I Love F# for Mathematical Planning
https://matthewcrews.com/blog/2020/12/2020-12-09/
Wed, 09 Dec 2020 00:00:00 +0000https://matthewcrews.com/blog/2020/12/2020-12-09/A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away
Antoine de Saint-Exupery On my journey of growing as a developer, I am consistently inspired by language features which seem incredibly simple but yield remarkable benefit. As I try to master F#, I am frequently surprised by how powerful the language is for expressing ideas while having so few features.Reindeer Secret Santa Assignment Problem
https://matthewcrews.com/blog/2020/12/2020-12-07/
Mon, 07 Dec 2020 00:00:00 +0000https://matthewcrews.com/blog/2020/12/2020-12-07/Note: To see the completed code, please go here. All code for Model Mondays is kept in this repo and is MIT licensed. Feel free to use it!
I was having a chat with a friend about what types of problems are good candidates for Mathematical Planning. He posed the question, “Would a Secret Santa exchange be a good candidate?” At first, I thought, “no.” As we kept chatting though, I changed my mind.The Under Appreciated Power of Object Expressions
https://matthewcrews.com/blog/2020/12/2020-12-04/
Fri, 04 Dec 2020 00:00:00 +0000https://matthewcrews.com/blog/2020/12/2020-12-04/There is a feature of F# this is incredibly powerful and rarely talked about: The Object Expression. It is such a simple idea that it is almost boring but the implications of it are profound. We often define an interface to abstract the implementation of an object so that we can code against different implementations. By programming against an IEnumerable or IDictionary, we can write algorithms which work against a host of different backing data structures.The Mentor Matching Problem
https://matthewcrews.com/blog/2020/12/2020-12-03/
Thu, 03 Dec 2020 00:00:00 +0000https://matthewcrews.com/blog/2020/12/2020-12-03/There are few things I love more than a fresh mathematical planning challenge so I was delighted when Kevin Avignon reached out to me and asked me to look at a question he had posted on the Software Engineer Stack Exchange site. He wanted to know whether the question was a candidate for Mathematical Planning. The question is a really interesting problem of pairing Mentors and Mentees. Mentors have a set of skills they can teach.Modeling Non-Linear Functions with Flips
https://matthewcrews.com/blog/2020/12/2020-12-01/
Tue, 01 Dec 2020 00:00:00 +0000https://matthewcrews.com/blog/2020/12/2020-12-01/Recently I was asked if it would be possible to add the log function to the Flips library. Flips is a library for modeling and solving Linear and Mixed-Integer Programming problems. Both classes of problems are constrained to only having linear (i.e. straight) lines. You may ask, “What do you mean by straight?” The following are examples of linear functions.
$$ \displaylines{ \text{Linear Functions}\\
y=1.0x+2.0 \\
y=2.0x_{1}+3.0x_{2} \\
y=1.2x_{1}+1.7x_{2}+x_{3} } $$What I Look for in a Machine Learning Engineer
https://matthewcrews.com/blog/2020/10/2020-10-08/
Wed, 07 Oct 2020 00:00:00 +0000https://matthewcrews.com/blog/2020/10/2020-10-08/I was recently asked by someone, “What do I need to do to get into Machine Learning and Finance industry?” I told them that I would think about it and get back to them. I have been in many interviews for Machine Learning Engineers and I do have a set of questions that I frequently use to get a feeling for where someone is in their career and where they are hoping to go.The Anatomy of an Optimization Model
https://matthewcrews.com/blog/2019/2019-10-27-the-anatomy-of-an-optimization-model/
Mon, 11 Nov 2019 00:00:00 +0000https://matthewcrews.com/blog/2019/2019-10-27-the-anatomy-of-an-optimization-model/I am on a bit of a quest to bring Mathematical Optimization to the masses, or at least to Software Developers. I often come across problems where people are wanting to find the best plan for their problem but they lack to tools to express the problem. Typically the way this is “solved” is by some domain expert coming up with a laborious heuristic in Excel which involves outrageous amount of copying and pasting.Discrete Optimization with Cutting Planes
https://matthewcrews.com/blog/2018/2018-05-24-discrete-optimization-with-cutting-planes/
Fri, 25 May 2018 00:00:00 +0000https://matthewcrews.com/blog/2018/2018-05-24-discrete-optimization-with-cutting-planes/Previously I described how we can perform Discrete Optimization using the Branch and Bound technique. Today I want to describe another foundational technique for Discrete Optimization, Cutting Planes. Cutting Planes is like the Branch and Bound technique in that it uses a series of LP Relaxations to search for solutions. Where it is different from Branch and Bound is in how it refines the LP Formulations. Branch and Bound would subdivide the solution space by branching on a decision variable and creating two new subproblems.Discrete Optimization with Branch and Bound
https://matthewcrews.com/blog/2018/2018-05-22-discrete-optimization-with-branch-and-bound/
Tue, 22 May 2018 00:00:00 +0000https://matthewcrews.com/blog/2018/2018-05-22-discrete-optimization-with-branch-and-bound/If you have spent any time with me you will know that I am passionate about Optimization. Now, you may pass this off as a bit of geekiness on my part but the reason I care about Optimization is that it has profound implications for how we care for people. When I get a moment to describe Optimization to someone the way I start off is by saying, “Optimization is the mathematics of caring for people.Creating Summable Domain Types
https://matthewcrews.com/blog/2018/2018-05-13-creating-summable-domain-types/
Sun, 13 May 2018 00:00:00 +0000https://matthewcrews.com/blog/2018/2018-05-13-creating-summable-domain-types/One of the reasons that I love F# is that is makes it incredibly easy to model domains. By creating a Domain Model which represents the business domain it becomes relatively easy to create workflows and algorithms which streamline business processes. In this post I show how to create types for a domain which are summable, a feature I use frequently in my work.
The Value of Restricting Values When I have to create a new Domain Model one of the first things that I do is define a single case Discriminated Union of decimal for the basic building blocks that I am going to work with (Costs, Items, Sales Rates, Days of Inventory, etc.F# for Optimization Modeling
https://matthewcrews.com/blog/2018/2018-05-04-fsharp-for-optimization-modeling/
Fri, 04 May 2018 00:00:00 +0000https://matthewcrews.com/blog/2018/2018-05-04-fsharp-for-optimization-modeling/I recently attended a training event hosted by Gurobi. For those who don’t know, Gurobi produces one of the best mathematical solvers in the industry. It was a great event and we were able to spend ample time with engineers and experts in the field.
Using a mathematical solver requires the ability to formulate models and at this time one of the easiest languages for doing that is Python. Python is a great language for many use cases.Domains Run Amok
https://matthewcrews.com/blog/2018/2018-01-27-domains-run-amok/
Sat, 27 Jan 2018 00:00:00 +0000https://matthewcrews.com/blog/2018/2018-01-27-domains-run-amok/I am a huge fan of Domain Driven Design and I have been trying to apply it more and more. I ran into a problem last week that kept beating me over the head though. I kept using a bottom up approach and kept coming up with terrible solutions. Finally, I took a more outside to in approach which cleaned up the solution. I credit Mark Seemann for the idea to work from the outside in.The Divide Operator is a Lie
https://matthewcrews.com/blog/2018/2018-01-14-the-divide-operator-is-a-lie/
Sun, 14 Jan 2018 00:00:00 +0000https://matthewcrews.com/blog/2018/2018-01-14-the-divide-operator-is-a-lie/One of the things that most attracted me to F# is the ability to accurately model your domain. What first turned me on to this was a talk by Scott Wlaschin on Functional programming design patterns. Scott has a more focused talk on Domain Modeling Made Functional that he did a few years later and a book with the same title. This whole concept was blowing my mind. The idea of modeling your domain such that illegal states are unrepresentable sounds immensely satisfying to me.My Most Expensive error
https://matthewcrews.com/blog/2018/2018-01-06-my-most-expensive-error/
Sat, 06 Jan 2018 00:00:00 +0000https://matthewcrews.com/blog/2018/2018-01-06-my-most-expensive-error/The title for this may be a little over the top but it is not far from the truth. I am wanting to show how Units of Measure in F# can protect against some of the most insidious types of errors, mismatched units.
One of the most difficult parts of putting together algorithms has been making sure that the Units of Measure for numbers match. For example, you should not be able to add lbs and cm, it doesn’t make sense.Using F# to Parse HTML
https://matthewcrews.com/blog/2018/2018-01-05-using-fsharp-to-parse-html/
Fri, 05 Jan 2018 00:00:00 +0000https://matthewcrews.com/blog/2018/2018-01-05-using-fsharp-to-parse-html/At work I have been tasked with extracting the product description information for several of our products to be used as an import for an external system. Normally I would just write a query for the database to get all of this information but in this case I do not have access to the database directly. Even if I did have it, I am not familiar with the schema so I would rather not have to spend the effort digging into if I do not have to.About Me
https://matthewcrews.com/about/
Mon, 01 Jan 0001 00:00:00 +0000https://matthewcrews.com/about/The best answer to the right question. I partner with teams to identify the decision processes that are driving their success then collaborate to build tools based on Machine Learning and Mathematical Planning to ensure the best possible answer, every time.
I also produce articles and training material to equip software developers to build their own Mathematical Planning models to provide outstanding solutions for their clients. Few things bring me more joy than seeing others harness the tools of Mathematical Planning to help others.Workshop
https://matthewcrews.com/workshop/
Mon, 01 Jan 0001 00:00:00 +0000https://matthewcrews.com/workshop/I am hosting a workshop on Mathematical Planning with .NET on December 28, 2020 at 9:00 AM PST. We will spend 4 hours introducing the idea of Mathematical Planning. The workshop is either a ride-along where you code the examples with me or you can just sit back and enjoy. By the end you will…
Know when it is appropriate to apply Mathematical Planning Have a starting knowledge of how to breakdown business problems into Mathematical Planning models Know best practices for structuring model code for testing and refactoring Understand the pros and cons of various delivery mechanisms.