
April 14th, 2013, 04:51 AM
#1
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.
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.

April 14th, 2013, 10:46 PM
#2
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.
Always use [code][/code] tags when posting code.

April 15th, 2013, 01:32 AM
#3
Re: Integer Programming Homework Assignment
You can record a MACRO using Excel, which IS actual VBA code (for Excel). Easy to modify or swap.

April 15th, 2013, 03:13 AM
#4
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, x1x3 <= 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.

April 16th, 2013, 09:48 AM
#5
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.
Last edited by Mur16; April 16th, 2013 at 02:05 PM.
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.
Featured
