Integer Programming Homework Assignment
Hello,
For a linear programming assignment I have been asked to write a programme using VBA which can solve a linear programming problem with an additional constraint that all solutions must be integers.
I have never used VBA before but I am following online tutorials and I am trying to learn at the moment. I have been given a Simplex algorithm written in Excel to work with.
I was just wondering if anyone has any experience in this area and can recommend which Integer Programming Algorithm would be most appropriate to write using VBA? All of the algorithms I am reading about seem near impossible to programme (they seem to need a lot of human deduction), especially for a beginner. :confused:
I'm sorry for asking such a general question. A small push in the right direction would help tremendously! I am using Retail 7.0.1627.
Thank you very much for your time, it's truly appreciated.
Re: Integer Programming Homework Assignment
I am not sure what you are looking for. If you input is integer then the only operation that would give a non integer would be division example 1/2
I think you would need to explain what kind of problem you are trying to solve to get a good answer.
Re: Integer Programming Homework Assignment
You can record a MACRO using Excel, which IS actual VBA code (for Excel). Easy to modify or swap.
Re: Integer Programming Homework Assignment
Hi Datamiser, my apologies for not being clear, thank you for your time. I am talking about a linear programming problem, with linear constraints.
For example, find the maximum of Z = x1+x2+x3 for which the following constaints are satisfied: 3x1+4x2+x3 <= 20, x1+x2 <= 6, x1-x3 <= 2, x1 x2 x3 integers. (Random examples, probably give a poor solution). When solving this normally, it's possible to get the optimal solution whereby x1 and/or x2 and/or x3 are not integers. I am trying to find the best solution available where they are all integers. For example, this is a production problem and you can't make/sell half a chair. I am trying to write a VBA code with say ten macros going through this process. Excel is able to do this using the solver command but we have to write our own solver.
Thank you dglienna, I will definitely look into that, it should help a lot with my learning!
I thought that perhaps this was a common VBA exercise but I think now that it is rather specific to linear programming courses only. I will keep trying things out and hopefully one day reach the solution. Thank you for your time and advice and apologies for asking a poor question.
Best wishes.
Re: Integer Programming Homework Assignment
Can you hard code the polynomials or is it supposed to take those as input? If you can hardcode then create an N dimensional array of all integers (with a reasonable limit):
(0,0,0)
(0,0,1)
(0,0,2) . . . etc.
run them through the constraint polys and collect the set of "pairs" that work. Then run these pairs through the optimization poly to see which one produces the max.
This is kind of knuckle dragging but it may work. I don't know the level of the class so I am not sure of the sophistication expectations.