11

I have been accepted for an internship for 6 months. The aim of this internship is to implement a "generic" solver for scheduling/production planning problems. This solver will bill a small prototype for a saas product.

I am aware that there is a huge number of this kind of problems. It seems that this is a very ambitious (or even a non-realistic) goal to finish within only 6 months. It's frustrating and I don't know where to start, in particular because there is no OR expert in the company. So I need to really focus on a small part of the problems.

So, my questions are, 1) What to do in order to progress as much as possible, how to filter the problems to focus on? 2) What are the easiest methods to use when solving etc. (I do not need necessarily exact methods, I am thinking about metaheuristics)? 3) Is there some examples of these kind of solvers?

Any other suggestion/idea/advice/resource/etc. that could help making the experience less frustrating is welcome.

EDIT: The main issue that is causing the frustration is how to identify the "common" problem(there is far more than a single problem in scheduling), I don't know how to proceed or even where to start.

Antarctica
  • 2,917
  • 15
  • 34

5 Answers5

10

As you mentioned about "scheduling/production planning problems", I refer it to manufacturing planning and detailed schedule. Also, I know that there are specific methods to solve other planning and scheduling problems. (E.g. vehicle routing problem variants). Planning and Scheduling, specifically in the real application, will need to survey from some essential aspects:

1) Understanding, which kind of problem you have faced? For example, in the machinery area, what is the specification of the environment? job shop, open shop, etc?

2) How much your problem scales?

3) Which one method, (exact or (meta)heuristics), could be used to solve the problem?

4) How do you want to represent your problem results?

Based on the above questions (also there are others) you could try implementing your own/specific solver.

Also, it should be noted that:

  • If you are going to develop a mathematical program, it would be considered usually, each problem needs a specific MP and you might have to develop many models.

  • If your problem's scale is large and your model is straight forward, you would expect to solve the problem using open-source solvers otherwise, you should use the commercial solvers which need more cost or you will need some professional skills to use an advanced approach like decomposition method.

  • As per, many real problems should be solved in a reasonable time, (meta) heuristics like CP, genetic algorithm, etc can be applied.

  • As MSExcel is frequently used in industry and what you are looking for is based on excel, you can try developing an excel-based solver.

  • If you are interested to develop a friendly user-interface, using a programming language (like C++, Python, etc) might be interested. Specifically, combining with the solver.

Finally, some references and related questions, which I hope to be useful, are:

A.Omidi
  • 8,832
  • 2
  • 13
  • 49
  • 1
    As far as I know, MIP solvers(especially open-source) are not too good to solve all kind of scheduling problem, some problems are harder than other. Am I right? If so, what is the class of problems that I can easily treat with MIP solvers ?. Another question : a decomposition method gives a bound on the problem, I believe that I need to apply a heuristic to find a feasible solution, Am I right ? – Antarctica Feb 05 '20 at 02:34
  • 1
    State-of-art solvers like CPLEX or GUROBI can solve the scheduling models (MIPs) even in the large scale sense. Cplex has CPO engine which has been designed to solve the large scale models efficiently. Some open-source solvers like coin-CBC can solve large scale models if the problem formulation has been straight forward. To know what classes can be solved using MIPs, the best way is searching in articles or trying yourself. please, see this question. – A.Omidi Feb 05 '20 at 05:51
  • 1
    As other community members mentioned too, one of the best ways to attack the real planning and scheduling problem is using heuristic methods. If you are interested in the programming language you could try writing your heuristic algorithm. AFAIK, some decomposition variants like branch-cut-price can solve the large scale scheduling problem and it's an exact method. But as I said, it needs some professional skills. I hope it would be useful. :) – A.Omidi Feb 05 '20 at 05:57
7

The "generic" aspect of the solver might just mean that management has, um, inflated expectations. That said, and focusing on the use of metaheuristics, I'll throw out a few ideas.

  1. Where possible, use a (well-crafted) third-party library to do the actual metaheuristic computations, rather than writing your own. It's likely to be faster than what you would produce, it will certainly save you development time, and if you are using parallel threading it may save you some sleepless nights.
  2. After ascertaining just how generic this solver is supposed to be, look for common elements among the problems it is intended to solve, and then look for metaheuristics designed for problems with those elements. As an example of what I mean, a lot of scheduling problems largely boil down to some combination of ordering a list of activities and maybe winnowing out some. There's a variant of genetic algorithms called random-key genetic algorithms that are easy to implement for problems of that type. (I don't know how their performance compares to other metaheuristics, but I do know they are fairly easy to implement.)
  3. You do not have to limit yourself to one metaheuristic. You could code the program to run metaheuristic races one each problem (e.g., one thread running simulated annealing, another thread running 2-opt or 3-opt, another thread or two doing a GA), possibly with solution swapping among the methods (restart method 1 at some point using method 2's best solution ...), and then give the user the overall winner.
prubin
  • 39,078
  • 3
  • 37
  • 104
  • On using different methods: What do you think about using some exact algorithms for some problems(e.g;. problems in $P$) and/or a MILP open source solvers for some others? What is the class of problems that I can easily treat with MIP solvers? What do you think about decomposition methods(e.g. branch-cut-price)? (AFIK decomposition methods are not widely used in industry and they have a considerable implementation effort.)

    On the complementarity of the methods Is your 3rd point still doable with methods of different families? How to ensure some "complementarity" across the methods?

    – Antarctica Feb 06 '20 at 02:12
  • I hesitate to declare any problem type "easily treat[able] with MIP solvers", with one exception: if the problem is a pure integer problem, the data is all integer and the constraint matrix is totally unimodular, you can solve it as an LP, which makes it easy. I don't really know if BPC is useful for scheduling problems (never having tried it). As far as complementarity goes, I don't think can (or need to) ensure it. You just roll the dice and take your chances. – prubin Feb 07 '20 at 22:20
7

Before you even start worrying about algorithms, you need to figure out the solver's architecture. You can do so by posing and answering questions such as the ones I ask below. The answers will be a function of the goals of the project, the help & know-how of the people who employ you and, crucially, what you can realistically do in 6 months. Keep in mind that writing an interface you've never seen before can easily take a month or two so experiment first before committing.

  • what language are you going to use?

  • what build system are you going to use?

  • what types of OSs will you support?

  • do you have a way of getting the math in the solver or so you need to write a parser?

  • will you code the LP/MILP part yourself or link third party? If you code it, you'll need to identify, write an interface to, and link, a factorisation library.

  • if you use third party, you'll have to write the interfaces. Ideally, pick libraries with ok-ish interfaces to the language you're using.

  • how is the user going to retrieve the result? What are the exit flags/convergence conditions going to be?

  • are you going to use a parallel framework? If so, and you choose multithreading, are your dependencies thread-safe?

  • what framework are you going to use for integration testing/unit testing?

  • are you going to support non-linear functions? If so, you'll need computational graphs and ways to get derivatives.

  • are you going to use a sparse container to represent your coefficient matrix? If so, which one and from what library?

  • do you need to support callbacks/signal handling?

  • is your software going to be use standalone or invoked as a library?

  • how are you going to handle exceptions?

Nikos Kazazakis
  • 12,121
  • 17
  • 59
  • Thanks for you detailed answer, I already have some answers but I am not sure that I understand all of your questions. 1. I'am going to use Python, 2. What do you mean by "build system", 3. Windows & Mac, 4. What do you mean by "getting the math in the solver or so you need to write a parser", 5. I have the possibility to use open-source solvers so I will not code the MIP/MLIP part on my own, Is that what you meant?, 6. What do you mean exactly by interface in "if you use third party, you'll have to write the interfaces." – Antarctica Feb 06 '20 at 14:09
  • I don't yet have an idea about how the user is going to retrieve the result, 8. What do you mean by dependencies in "thread-safe dependencies", 9. I am going to use pytest for usint testing, 10. No, I will not support non linear functions, 11. What is a sparse container?, 12. I don't know yet about callbacks etc, 12. It will be used as a stand alone. However, if there is enough time I may need to code a python API for my solver, 13. What kind of exceptions? I think it's straightforward using python
  • – Antarctica Feb 06 '20 at 14:17
  • make/CMake/Ninja etc. which you might need for your dependencies, 4. Solvers understand matrices and graphs, so you need a way to communicate your formulas to the solver (e.g., GAMS, Pyomo, or a parser to do the conversion), 5. yes 6. Not all solvers/libraries have Python APIs, check in advance, 8. I mean libraries that are not-thread safe, 11. Google "sparse matrix", 13. Your libraries might throw exceptions, and you might as well in case of errors, it's good to consider the semantics of when & how to handle them, both for yourself and for your users.
  • – Nikos Kazazakis Feb 06 '20 at 17:58
  • Did you mean that, when we face a large scale problem but that has the property of sparse coefficient matrix, it's good to find a way to store the matrix efficiently?
  • – Antarctica Feb 06 '20 at 18:29