Genetic Algorithm for Hybrid Flowshops Scheduling using Python - python

I apply optimization tool to solve pratical production planning problem.
My current problem is doing planning for a factory with various items in a unique production flow stage. In each stage, there are few parallel machines as graph below.
I have done maths MILP model, and try to solve by CPLEX but it too hard to handle the big scale model by itself.
Currently, I prepare to use Genetic Algorithm to solve it, but don't know where to start.
I have some knowdlege in Python Language. My friends, please advise how I start to deal with this problem?
Do someone have a similar solved problem with code, that I can have a reference?

Before you start writing code(or using someone else's) you must understand the theory behind the scene.
What are the main entities of your Production System?
You need to formulate optimization objectives,optimal schedule but defined in terms of optimization problem.
One example that comes to my mind
https://github.com/jpuigcerver/jsp-ga
Take a look at this thesis
http://lancet.mit.edu/~mbwall/phd/thesis/thesis.pdf

Related

Gekko(python) for lap time optimization

I was wondering if it was a good idea to use Gekko to solve a lap time optimization:
finding the optimal path on a track to minimize total time by controlling the steering angle and the power output.
I'm fairly new to optimal control problem so if you had pointers on how to start that would be great.
Thanks
The bicycle optimal trajectory problem is possible in Gekko. I recommend that you start by working out simple benchmark problems and then take a staged approach (1D to 3D) to building your application. Also, if the authors are willing to share their model, it is often easier to replicate and extend their results. Here are some links to help you get started or see what is possible with a complex trajectory optimization problem (HALE aircraft).
Example problems
Introductory Optimal Control Benchmark Problems with the minimized final time.
Energy optimization for HALE aircraft trajectory optimization (source code).
Inverted Pendulum
There is also the machine learning and dynamic optimization course that is freely available online if you need additional help getting started.

Search Strategies for MIP solver OR-tools in Python

I'm currently solving a shift assignment problem in OR-tools in Python, using a MIP solver, one employee at a time. For each seperate problem there is one employee and around 100 shifts. There are a lot of variables and constraints (few 1000's per employee). I've already looked in detail on how to improve each constraint, but no luck. Since the performance is really important, I wanted to further investigate the possibilities to adjust the search strategies, but no luck either. It seems that the documentation is sparse.
Can anyone help me by giving me some options to look into?
This is the solver I'm using:
pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING
Thank you in advance. Let me know if there is any information I need to add here.
You are out of luck. There are no customisation available for the search through the linear solver wrapper.
I would suggest using the CP-SAT for this.
You can have a look at:
https://github.com/google/or-tools/blob/master/examples/python/shift_scheduling_sat.py

Implement an incremental optimization for MILP

I am trying to implement an incremental optimization where I can feed my MILP model with new constraint/variables and remove some other constraints/variables as time passes. Not to mention solved variables should be treated as fixed values as long as they are not removed.
My question is if there is a standard way/tools to do it?
What I thought about so far is to manipulate GAMS sqlite database using python, any better idea?
It is fine to use other environments.
I appreciate any clue to implement such thing. Thanks

ABM under python with advanced visualization

sorry if this all seem nooby and unclear, but I'm currently learning Netlogo to model agent-based collective behavior and would love to hear some advice on alternative software choices. My main thing is that I'd very much like to take advantage of PyCuda since, from what I understand, it enables parallel computation. However, does that mean I still have to write the numerical script in some other environment and implement the visuals in yet another one???
If so, my questions are:
What numerical package should I use? PyEvolve, DEAP, or something else? It appears that PyEvolve is no longer being developed and DEAP is just a wrapper on the outdated(?) EAP.
Graphic-wise, I find mayavi2 and vtk promising. The problem is, none of the numerical package seems to bind to these readily. Is there no better alternative than to save the numerical output to datafile and feed them into, say, mayavi2?
Another option is to generate the data via Netlogo and feed them into a graphing package from (2). Is there any disadvantage to doing this?
Thank you so much for shedding light on this confusion.
You almost certainly do not want to use CUDA unless you are running into a significant performance problem. In general CUDA is best used for solving floating point linear algebra problems. If you are looking for a framework built around parallel computations, I'd look towards OpenCL which can take advantage of GPUs if needed..
In terms of visualization, I'd strongly suggest targeting a a specific data interchange format and then letting some other program do that rendering for you. The only reason I'd use something like VTK is if for some reason you need more control over the visualization process or you are looking for a real time solution.
Probably the best choice for visualization would be to use an intermediate format and do it in another program. But for performance, i'd rather configure a JVM for a cluster and run NetLogo on it. I've not tried it yet but i'm thinking seriously to try NetLogo on a Beowulf style cluster.
BTW, there is an ABM platform called Repast that is said to have Python interface if you're planning to implement your code in Python.

Nash equilibrium in Python

Is there a Python library out there that solves for the Nash equilibrium of two-person zero-games? I know the solution can be written down in terms of linear constraints and, in theory, scipy should be able to optimize it. However, for two-person zero-games the solution is exact and unique, but some of the solvers fail to converge for certain problems.
Rather than listing any of the libraries on Linear programing on the Python website, I would like to know what library would be most effective in terms of ease of use and speed.
Raymond Hettinger wrote a recipe for solving zero-sum payoff matrices. It should serve your purposes alright.
As for a more general library for solving game theory, there's nothing specifically designed for that. But, like you said, scipy can tackle optimization problems like this. You might be able to do something with GarlicSim, which claims to be for "any kind of simulation: Physics, game theory..." but I've never used it before so I can't recommend it.
There is Gambit, which is a little difficult to set up, but has a python API.
I've just started putting together some game theory python code: http://drvinceknight.github.com/Gamepy/
There's code which:
solves matching games,
calculates shapley values in cooperative games,
runs agent based simulations to identify emergent behaviour in normal form games,
(clumsily - my python foo is still growing) uses the lrs library (written in C: http://cgm.cs.mcgill.ca/~avis/C/lrs.html) to calculate the solutions to normal form games (this is I believe what you want).
The code is all available on github and that site (the first link at the beginning of this answer) explains how the code works and gives user examples.
You might also want to check out 'Gambit' which I've never used.

Categories