lundi 28 décembre 2015

random number in python with constraints dependent on random numbers, Columns and Rows have to be unique: Pic Included

I'm helping my uncle out for a project and I realized I cannot use Excel for the solution--need to find a new way to solve:

The Problem:

Random number generation with constraints that are dependent on each row. See attached image: http://ift.tt/1OhrPOl

Each cell in every row (33 rows total) has to be different number between (1 - 33 ( only 17 are used per row)) but each column has to be different each week (all 33 are used).

Inputs:

I want the input variables to be a random number between 1-33 with the constraints above. For every row there are 17 inputs, for 17 weeks. so 561 inputs.

The problem is linear and I can't see it being too hard, but I'm not that good with python, so it is very hard.

My steps so far:

I put all the constraints into Excel solver and should have received a solution, but I have too many variable cells and it cannot solve (max variable number in Excel is 200).

I'm deciding to try python to try and solve now. I have random generation down, but can't figure out how to make sure 17 weeklyColumns with 1-33 sequence for each week.

I'm sure python has a solution, but would another language be easier?

Any tips?




Aucun commentaire:

Enregistrer un commentaire