MOR is basically an ASCII word processor, which is used to build data sets for two computer programs used in this class: Linear Programming (LP) and Block Oriented Systems Simulation (BOSS). Once the data sets are formed, you can use MOR to save your data, and to link to the LP and BOSS programs to run your data. If errors are present, MOR will go back to the data entry mode and try and put the cursor as close to the error as he can, so you can correct it. If the program runs, he will list the answers for you, then revert back to the data entry mode so you can alter the data and re-run it if you wish.
You can use any ASCII editor to form your data sets, such as Notepad or Editpad. Both of these are better ASCII word processors than MOR. If you use a better editor you will then have to use it to save your model on disk, and then use MOR to go get the file to be run. Simply open MOR, hit F10(menu), F(file), O(open), and type in the name of your file, including how to get there. For example: “Open File: C:\mor\prob82 or C:\mor\prob83.LP” or whatever. Both Notepad and Editpad are full function windows apps, and therefore can cut and paste, whereas MOR cannot.
You can download the program onto your home personal computer or even better, a thumb drive, by clicking (or right-clicking) here. If you download it to a thumb drive you can take it with you and run it on any computer.
MOR is an old DOS program, and as such you MUST use the old DOS file naming conventions. Legal DOS file names cannot have more than 8 letters in the name, and 3 characters in the extension. You should also probably avoid deep subdirectories. You will have no end of grief if you put MOR and all the programs in a subdirectory called C:\stuff for my classes\lowery’s junk for 422\mor\linear programming. It just doesn’t understand that level of sophistication. Make a subdirectory, or folder, called C:\NewMOR of E:\NewMOR and that’s it. Put the main program and support programs and everything else associated with MOR, including your homework files, in that directory. That way MOR will be able to find the necessary programs as well as your homework problems. It also makes it possible for you to type in the name of your file, like C:\mor\problem14.txt. Except that won’t work, because legal DOS file names cannot have more than 8 letters in the name, and 3 characters in the extension. Use C:\mor\prob14.txt or something like that. If you are using the CE lab computers and want to run the problems from a floppy disk, put the problems on the root directory of the floppy. Also, 63.mor is not a legal name. Change it to M63.mor or something like that with a letter on the front.
NOTE: You can form your dataset using Word or any other word processor, which is much more convenient that using MOR to build it. However, you cannot run that file since it is full of goofy formatting characters. When you finish forming your program you will have to “SAVE AS” and then save it as a simple txt file.
NOTE ALSO: You cannot run your file with MOR if you have it open in any word processor. The word processor will lock the file from access and MOR won’t even be able to see it. You will get a “File Not Found” error. Close out all programs using your program file before trying to run it with MOR.
Downloading the program
Click here for information on downloading and running the program.
Linear Programming Mode
When you run the program, the following screen will appear:
You can clear the splash screen by hitting the escape key. There is a typing help screen for marking blocks and deleting blocks and moving blocks, etc. Hit CTRL + F1 to see this screen. The help screen normally available by hitting F1 is listed at the end of this tutorial, since it doesn’t seem to work inside MOR. When you get the above screen, you may type in your model.
Linear Programming Model Restrictions:
- Please note that you cannot use numbers like .6 in your model. You MUST use 0.6 for the program to understand what you want. If you type .6, he thinks it is an error in which you meant to type something like an array of numbers from 3 through 6 (3..6) and forgot to tell him the 3.
- Only the following symbols are permitted: = and <= and >= . So, if you use the symbol < the program won’t run. You MUST use <= for that. You also cannot use =<. You must use <=. You cannot use < = with a space.
- All variable names (things like x, y, cows, dogs, etc.) MUST be placed on the left hand side of the equation. The right hand side must contain nothing but numbers, or zero.
- Surprisingly, JR <= 8*20*40 is not permitted. You cannot calculate on the right hand side. You must say JR <= 6400.
- ST is not permitted as a variable name. So if you have a node S and a node T, and a node arrow from S to T, you will have to call it something else besides ST. Perhaps cat, or dog. ST is a reserved name for “Subject To”, and MIN and MAX are also reserved words. Avoid them.
- If your min z line gets longer than the screen width, simply hit the enter key to continue it. Thus:
Min z = asd + sdf + dfg + fgh + ghj + hjk + jkl + iop + uio + yui + tyu + rty + ert + wer + qwe + zxc
+ poi + oiu + iuy + uyt + ytr + tre + rew + kljk + jhg + hgf + gfd + fds
+ 12sdf + 23ddfg + 56ytr + 57utr is acceptable.
- If you have 3x+5y <= 2(x+y) you cannot say (3x+25)/2(x+y)<=1, even though that may be legal algebraically. That’s because if the best solution comes out x+y = 0, a perfectly possible outcome, you have no equation. It is indeterminate. You will have to write it: 3x+5y<=2x+2y and thus (3x-2x)+(5y-2y)<=0. You can leave it like that, or help him by changing it to x + 3y <= 0.
As an example, assume that your model is as shown above. Before you run it, you must tell MOR what kind of problem it is – LP or Simulation (BOSS.) You do this by hitting the F10 (Menu, or more appropriately the Sub-Menu screen) key. This brings up the following screen:
The first option on this screen is obtained by highlighting the word File. Options on this drop-down menu include File operations, including Open an existing file, Close the current file, Save the current file, SaveAs the current file under a new name, Rename the existing file, etc.
Highlighting “System” allows you to tell MOR that the problem to be run is a “Linear (programming)” problem, or a BOSS (System Simulation) problem. Merely highlight the word “System”, then the word “Linear” and hit the enter key to run linear programming problems. Highlight the word “Simulation” to run BOSS simulation problems.
The “Algorithms” drop-down menu can then be used to tell MOR what kind of a LP problem you are trying to solve. In most cases you should use the “Simplex” method. However, if you have a problem where all of the variables are “binary”, or “yes/no” or “on/off” or “0/1”, then you should use the “Zero/one” algorithm. If you have a problem where all of your variables are integers, i.e. 0, 1, 2, 3, 4, etc, then use the “all Integer” algorithm. If you have a problem where some of your variables are integer, and some are just regular numbers, use the “Gomory cut lp” algorithm. These are the only ones we will use in this class, and cover a majority of civil engineering problems.
Note the following restrictions:
To use the “Zero/one (Binary)” algorithm you must include the word Binary at the end of your data set.
To use the “Integer” algorithm, you must modify all of your equations such that all of your coefficients and constants are integers
(i.e. if you have 3.2x + 4.65 y <= 12, change it to 320x + 465y <= 1200, which is the same thing, but all coefficients and constants are now integer.) For this algorithm you must also help him get the answer by adding the following statement at the end of your model: Boundonsum = the sum of all your answers. For example, if you ask him how many two bedroom apartments (A2) and how many three bedroom apartments (A3) and how many four bedroom apartments (A4) you should build, and you don’t want answers like 63.21 one bedroom apartments, and 26.89 two bedroom apartments, etc. then you will use the “Integer” algorithm to force him to find the best solution only using integer numbers (which surprisingly may then turn out 60 one bedroom apartments, 30 two bedroom apartments, etc, not at all just the original numbers rounded to the nearest whole number!) Now to help him not run off into outer space in getting you an answer, he needs to have some limit beyond which you don’t think he should bother checking – i.e. the bound of the sum of your answers. Thus if you know you only have so much money, and so much lumber, and so much brick, then you know danged well that A2 + A3 + A4 cannot be much bigger than 500? 1000? Then tell him so: Boundonsum = 500. This statement is only required in the integer and allinteger routines.
Under “Options” you can set the output to the screen, for your use in checking out your models, and once the program runs, you can set the Output to the Printer or to a File name. If you cannot get the program to go to the printer, you should output the answers to a file, and then print them out using a word processor (see Options below.)
You can now either run the problem from this screen (highlight “Run” and hit enter) or you can hit the escape key to revert back to the Main Menu, and run it from there. Typical output is shown below.
Note that when you try to print using this program, it is an old DOS program, and your printer may not have been set up to print DOS output. If you cannot get your output to print, simply redirect the output to a file, pick it up with a word processor, and print it from there. To try and just print the file, click on F10 to get to the submenu, then O for Options, then O for Output, then P for printer. If you don’t get any output to your printer, then you will have to click on F10 to get to the submenu, then O for Options, then O for Output, then F for File. The screen will show you where the program put your output, probably in the same subdirectory as your original data file. If the name of the file you ran is C:\stupid\lowery\problem1, the the output file will be called C:\stupid\lowery\problem1.OUT. Then go to Notepad, or Editpad, or Word, or any word processing program and get the file and print it out.
HELP ON SYNTAX
You can add comments: “can be anywhere, enclosed in double quotes”
LIMITS: Maximum number of variables is 150, including any slacks, surplus and artificials added by the system. Maximum number of constraints is 60.
GRAPHICS: The solution space and simplex algorithm steps can be graphically displayed for two-dimensional problems. To utilize these graphics capabilities, the keyword GRAPHICS and the region to be plotted for the x-axis and y-axis must be given. This only works using the simplex algorithm. The syntax is:
GRAPHICS (x-lower, x-upper, y-lower, y-upper)
example: GRAPHICS( -1, 4, -1, 10)
STANDARD input format:
maximize z = 3×1 + 2×2 “can be minimize, max or min – comments permitted on each line”
subject to “can be abbreviated as st”
4×1 + 3×2 <= 5
2×1 – x2 = 2
x1 + x2 = 3
x1 >= 0, x2 >= 0 “non-negativity is always assumed, so this line not required”
NOTE: The right hand sides of all equations MUST be a single constant number, or zero! Note also that slacks, surplus and artificial variables are added by the computer program if needed and NOT by the user. Also note that you must use =, >= or <=. You cannot use =>, >, < space =, or anything else. ONLY = <= >= That’s it.
INTEGER: List of variables for restricting variables to integer numbers. Example: INTEGER(x1, x3) restricts x1 and x3 to integers for an integer programming problem. For all integer variable problems, every one of the problem’s coefficients must be integer and a bound on the sum of the variables statement (Boundonsum = 100? or 500?) is required.
ALLINTEGER allows the declaration of all variables as integer without listing all the variables in the INTEGER list. If the ALLINTEGER algorithm is to be used then the BOUNDonSUM = value is required. Can be used in Gomory-Cut and AllInteger algorithms; ignored if other algorithms are chosen. The Allinteger algorithm is an efficient procedure for solving integer programming problems where every variable in the model is restricted to an integer.
BINARY: Used to indicate that all problem variables are to be 0/1 variables. This keyword causes the Balas zero/one algorithm to be selected. To use, merely include the word BINARY or AllBinary at the end of the model.
ALLBINARY: Used to indicate that all problem variables are to be 0/1 variables. This keyword causes the Balas zero/one
algorithm to be selected. To use merely include BINARY or AllBinary at the end of the model.
BOUNDONSUM The AllInteger algorithm requires that a bound estimate be given for the maximum value of the sum of the variables. Example: BoundonSum = 500. Boundonsum = 5000. Boundonsum = 60000000000.
Block Oriented System Simulation Mode (BOSS)
MOR operates in the same fashion for BOSS as for LP. You merely type in your BOSS model, save it, use F10 to tell MOR what kind of problem you are running (Simulation) and run it. There are many more key words in BOSS that you are not permitted to use, including ATTRIBUTES, QUEUE, RESOURCE, etc. See the handout on BOSS for a more complete list.
I spoke with you regarding homework problem 5-62. You demonstrated the method for which to solve this problem using equals signs (i.e. 1-AB-AC-AF-AG=0). I’m running the program using Zero/one lp and have included “binary” in my syntax. The problem I am encountering is that MOR says “Error: Equality constraints not allowed in binary problem.” Is there a quick fix or have I run out of time?
Joe: Always run your problems using the Simplex method first. Then go to one of the more sophisticated methods if it doesn’t give you the binary you want. It turns out that this problem will run fine using the Simplex algorithm. Regarding equality constraints not permitted, that’s true. You have to live with <= or >= for all of your constraints, but that’s usually not a problem. Just see if you can live with <= or >= instead of = on all of your constraints.
To: Lowery, Lee
Subject: Printing MOR Output
Once I have input my arguments and run the MOR program, how do I print my output?
Print it to a file, then pick up that file with a standard word processor and print it out.
To: Lowery, Lee
Subject: Re: MOR printing
I watched your help video and tried to save it just you did, but it wouldn’t work. I also tried to send it to a file, but couldn’t find that file later.
Would it be all right if I typed up my input and results and printed that off word?
Sure, but it’s much easier to:
1) Run the problem and print it to the screen and see your output.
2) Since you just ran it, you KNOW where the original data file is at.
3) Set it to print to a file and re-run it.
4) That output file is in the same subdirectory as is the original problem, and has the same name as your original problem, except the extension has been changed to .out.
5) Use your word processor, go to where you put the original input data file and make sure your word processor knows you are looking for a .out file. It may only show you the .doc files because that’s what he likes.