MPL(Mathematical Programming Language) is an advanced modeling system that allows you to set up complicated models, involving thousands of constraints, in a clear, concise, and efficient way and is extremely user-friendly and powerful. MPL offers a feature rich model development environment that takes full advantage of the graphical user interface in MS Windows, making MPL a valuable tool for developing LP models. MPL has features that allow you import data directly from a database and then after solving the problem export the solution back into the database. This along with the ability to be called directly from other Windows applications, such as databases and spreadsheets, make MPL ideal for creating end-user applications.
MPL has an upper limit of 2.1 Billion constraints and variables which is more of an theoretical limit than a real one. In virtually all cases models in MPL are only limited by the amount of memory that is available on the machine. Typically, MPL uses about one megabyte per 50,000 nonzeros or about 10,000 variables. This excludes the amount of memory that is needed by the solver which can be considerably more. For example, CPLEX recommends about 1MB per 1,000 variables, but it does not always need that much (Depends on the complexity of the model).
There are solver and MPL options both these can be changed using the dialog boxes or by changing them in the project file (*.mpj). One can reset these parameters to their defaults in two ways. One is to delete the mplwin.mpj file in the MPL directory. This would result in MPL resetting to its default settings when MPL is opened. One can also reset to the defaults within the MPL environment.
To reset the MPL options go to: Options | MPL Options List Select the default button this will reset the MPL options to their default value Resetting solver options go to Options | Solver Options List
Select the respective solver one is using and select the Set All to Default button.
In order for you to print the manual for your project it is not necessary to print it from the Maximal Web page. The MPL for Windows you downloaded also contains the manual in the On-Line Help System. Therefore, to print entire sections of the manual, just highlight the corresponding book icon in the help topics and press the Print button. For example, if you want to print the section for the MPL Modeling Language select that book icon and you will get all of the sections that are under that category.
An MPS file contains the nonzero values that define the instance of the model. This is the standard format for linear programs and can be useful as input to solvers or algorithms that do not have a direct link to MPL. To generate the MPS file do: Run | Generate File | MPS.
Yes, we do have the software available for download through FTP which makes it easier to download large files through a slow connection. The quickest and probably the easiest way to get the software, if downloading from the Web does not work, is to get it from our anonymous FTP server at ftp.maximalsoftware.com.
You should now be able to start the installation by double-clicking on the Mplwin42Student.exe file you downloaded from the FTP server.
You may download as often as needed until you have successfully downloaded the MPL/CPLEX student version.
There could be a problem with the CPLEX license file, Access.ilm. Often when one receives the license code the email program may word wrap the license. The license should always be either 2 or 3 lines depending on the type of license. One can also check the validity of the license file by running ilmcheck.exe.
There could also be an issue with the environment variable ILOG_LICENSE_FILE which is not pointing to the correct license file. One can view these variables either by using the set command in a DOS window or going to Control Panel | System. Select the Environment Variables button in the Advanced tab. The ILOG_LICENSE_FILE should point to where the Access.ilm is stored usually as:
ILOG_LICENSE_FILE=c:\MplWin4\access.ilmIf the Access.ilm file looks good and the environment variable settings are correct then contact us.
The CPLEX error code 1001 signifies that the machine has run out of memory to continue on with the solve process. This usually happens when solving very large LP's or difficult MIP models.
Often the presolve and MIP strategies in CPLEX can be memory intensive, one might want to try changing some of the CPLEX MIP strategy and Cut options to see if they lead to better solutions times and/or less memory usage.
Check to see if you received the license activation code for CPLEX and it has been installed correctly as detailed in the download instructions.
The CPLEX license error message 32041 that you received usually means that the environment variable CPLEXLICTYPE was not set correctly as described in Step 1. of the instructions.
If this environment variable is not set, CPLEX will look for a hardware key which is not available, hence the message. When the variable is correctly set, CPLEX will know that you are installing a license that does not need a hardware key. To check the environment variable, open a MS-DOS command window and issue the command SET from the DOS prompt. One of the lines listed should contain the following:
CPLEXLICTYPE=DEFAULTPlease note that there should be no spaces either before or after the equal sign. If there is a space or misspelling, please go back to the AUTOEXEC.BAT file (in Windows 95) and correct it.
If you have Windows NT you need to open the System Icon again in the Control Panel and correct the environment variable there. Afterwards, you need to reboot your machine for the new setting to take effect.
Now, you can try to activate the license again as described in Step 2. of the download instructions.
This message means that the code are entereing contains extra or illegal characters. Please try entering the license code again and make sure there are no extra spaces and that zero's and one's are not entered as the letters O and l instead of the numbers 0 and 1.
If the problem persists please send us by email a copy of the cpxlicen.log file in the c:\mplwin4s directory and the license code you are trying to enter.
We have seen this message few times on machines that are either rather old or have certain DOS games installed on them. The message means that your DOS Window is running in the so called MS-DOS mode which is incompatible with 32-bit programs such as the CPLEX license manager.
If you can change your DOS window from MS-DOS mode to back standard 32-bit setup you should be able to run the CPLEX license manager.
Alternatively, if that does not work, you should be able to run the activation command directly from the Start | Run menu.
Enter the following command in the Run dialog box:
C:\mplwin4s\cpxlicm.exe -vwhere c:\mplwin4s is the directory where you installed MPL and CPLEX. This method bypasses the DOS window and therefore should get around the 32-bit incompatibility problem.
To help us troubleshoot this problem send us copies of the following files on your machine to support@maximalsoftware.com:
We will examine these files for any problems, and if necessary, contact CPLEX tech support for their opinion on this problem.
What you are trying to formulate is a model that has logical expressions in it. These kind of constraints can be formulated in the following way:
Lets say you have a constraint
(x + y <= 5)
that only holds if binary variable is true. You then define the constraint as:
x + y <= 5 + M(1-a); where M is a large enough number for the condition (x + y <= M) to always hold true.
There is an excellent book available that covers this subject quite well, Model Building in Mathematical Programming by H.P. Williams published by Wiley.
This question is of similar nature as the previous question 4.1, it is just reversed. Basically you need to create a binary variable j that is True if (i > 2) and False otherwise.
If i is an integer variable you then define a set of constraints like:
i <= 2.5 + M * j; where M is a large enough number for the condition (M > i) to always hold true. This constraint forces j to one if (i > 2).
i >= 2.5 * j; this one forces j to zero if (i <= 2).
There is an excellent book available that covers this subject quite well, Model Building in Mathematical Programming by H.P. Williams published by Wiley.
What you are trying to formulate is a model that has logical expressions in it. These kind of constraints can be formulated in the following way:
To enforce a condition like:
{g(x) | A >= B}
Where one only generates a constraint if the data condition that parameter A is greater or equal to the value B. Enforcing these data conditions in MPL one uses the WHERE command in the constraint definition as shown:
LoadingCapacity[plant,product] WHERE (PlantProductStorage[plant,product] >= 1); LoadTruck <= TruckCapacity;
One can also specify data conditions on terms within constraints using the IIF and IF THEN statements
IIF(TruckLocation >= 1, LoadTruck, 0) + Inventory <= 50;
Where is the data vector TruckLocation is equals one then add the variable LoadTruck to the expression.
The default model setting in MPL is linear, thus if you want to create other model types such as non-linear or quadratic one needs to alter the Model Type setting. This can be done by going into: Options | MPL language.
This will open the MPL Language Options dialog box. Here you would need to set the "Default Model Type" to Nonlinear.Models. This method can be cumbersome, the preferred method is to actually set the model type in the model file itself by using the following syntax:
OPTIONS ModelType=Nonlinear
More complex expressions will require one to use the extended parser rather than the default standard parser. This can be set in the model file by:
OPTIONS Parsertype=Extended
Please note in order to solve non-linear models one will need to have use non-linear solvers such as CONOPT, LGO or Knitro.
Most LP solvers have post-optimality features that can give information on how the coefficients in the problem could change without affecting the solution.
The default post-sensitivity information outputted in the solution file from LP solvers only include the reduced costs and shadow prices. Some solvers have additional post analysis information such as ranging information which give the ranges of objective coefficients and RHS values that will still result in the same optimal solution. These features can be accessed in the solution file.
Options | Solution File
In the Solution File Contents frame, lists the various post-optimal analysis features one may want in the solution file.
A mathematical program is infeasible if there exists no solution that satisfies all of the constraints. Infeasiblities can arise because of erroneous data or bad formulation of the model resulting in one or more constraint conflicts. There is no steadfast rule or technique that can track any causality of infeasiblities. However there are some tools that can aid in searching out the possible causes.
Tools like the IIS found on older CPLEX versions and XPRESS and Conflict finder in CPLEX 10+. These will analyse the model and give back a reduced set of constraints that may be the cause(s) of the infeasiblity.
One can also use elements of gaol programming to identify possible causes by relaxing a or a set of constraints. Adding slack or surplus variables to these constraints and introducing high penalites in the objective function. Like shown:
MODEL MIN TotalCosts = SUM(I: ProdCosts * Produce + Penalty * SurplusCapacity) SUM(I,month: Penalty * SlackProduction) SUBJECT TO {Original Formuation Capacity[month] -> Cap : SUM(i: time*Produce) <= MachineHours ; MeetDemand[i,month] -> Bal : Demand <= Produce; } !Relaxed Formulation Capacity[month] -> Cap : SUM(i: time*Produce) <= MachineHours + SurplusCapacity ; MeetDemand[i,month] -> Bal : Demand <= Produce - SlackProduction;
Upon solving the relaxed model, any nonzero values in the slack or surplus variables will indicate which constraints are the possible culprits.
MPL has three types of random generator functions:
Uniform distribution signified by keyword
UNIFORM(low, high)
Will generate random numbers that are uniformly distributed between the low and high value, the RANDOM keyword will also generate a set of uniformly distributed numbers.
Normal distribution signified by:
NORMAL(mean, standard deviation)
Generates random numbers that obey the normal distribution with the specified mean and standard deviation.
Triangular distribution is a skewed 'uniform' distribution, MPL representation is by:
TRIANG(low,high,mode)
Generates numbers that ly between the low and high values obeying a uniformly skewed distribution base don the modal value.
All the random number functions have an extra optional argument that can specify the seed, if one needs to replicate the random data.
To define Special Ordered Sets (SOS) of variables in MPL. One uses the keywords SOS1, SOS2, or SOS3, and follows it with a list of the variables that belong to the set. This section can be anywhere after the constraints section. The variables can be either plain or structured.
SOS1 x1, x2, x3; SOS2 s[i]: SET(k: x[i,k]);
Generates i SOS2 sets with each set having k elements. One needs to check whether the solver you are using supports SOS features, otherwise you may have to implicitly model the conditions in the model.
One specifies a variable to be semi-continuous by using the keyword SEMICONT followed by the variable name. The semi-continuous section can be placed anywhere after the constraint section.
BOUNDS MinMach <= MachineHours[machine] <= MaxMach; SEMICONT MachineHours[machine];
The semi-continuous feature in MPL only works for certain solvers that can support semi-continuous variables. If one uses a solver that does not support this feature one has to implicity model the semi-continuous property by using binary variables as shown:
x <= Uy; x >= Ly;
Where U and L are upper and lower bounds and y a binary variable.
One can only use the ABS function of data not on variables, in order to formulate the absolute condition on variables one has to use a modeling trick
The free variable x can be thought of:
x = xpos - xneg
You can think of:
|x| = xpos + xneg xpos,xneg >= 0
One can then add the following to the objective
MIN c * (xpos + xneg)
This will force only one of xpos and xneg to be greater than zero and thus replicating the condition, absolute of x. In this method one has to be careful about the objective coefficients of xpos and xneg so that it does not affect the true objective value.
One exports the objective value in a similar manner as one does when exporting back the variable activity by utilising the EXPORT keyword and identifying data table or excel range one wishes the value to reside. One needs to specify the EXPORT statement after the objective function name.
In EXCEL:
MODEL MAX Profit EXPORT TO EXCELRANGE("Obj") = TotalRevenue - TotalCost;
This will export the value back to the Excel spreadsheet in the range defined as Obj.
In Database:
MODEL MAX Profit EXPORT TO DATABASE("Output", "Solution") = TotalRevenue - TotalCost;
This is done by using the keywords SHADOWPRICE and REDUCED COSTS in the export statement. One uses the syntax, EXPORT REDUCEDCOSTS TO .. in the variable definition and in the constraint definition one replaces reducedcosts with SHADOWPRICES. Examples of both instances are shown below
Produce[product, month] -> Prod EXPORT REDUCEDCOSTS TO DATABASE("Planning","Produce"); ProdCapacity[month] -> PCap EXPORT SHADOWPRICE TO DATABASE ("MonthsA","Shadow"): SUM(product: Produce / ProdRate) <= ProdDaysAvail;
MPL will only be able to retrieve data from cells or ranges in the first sheet, if you have data that is residing in other sheets one will need to specify the sheet name. This can be done by using an exclamation point between the sheet name and the range name like shown:
Demand[customer, product, month] := EXCELRANGE("Costs!Demand");
This will read in the Demand data from the range called Demand in the sheet called Costs. One can also specify the default Excel Sheet name one wishes to use in the OPTIONS sections like:
OPTIONS ExcelWorkbook="Planning.xls" ExcelSheetname="ResourcesData" DATA MachineRate[product] := EXCELRANGE("MachRate");
In the same model file one could use to redefine the default ExcelSheetname
OPTIONS ExcelSheetname="Costs" DATA Demand[customer, product, month] := EXCELRANGE("Demand");
One can put conditions on the export statement using the WHERE command. Conditions involving the indexes and references to data can be stated. One places the WHERE statement after the EXPORT keyword as shown:
VARIABLES Produce[plant, product, month] -> Prod EXPORT REFILL WHERE (month >=Mar) TO DATABASE("ProdPlan", "Produce"); Sales[product, month] -> Sale EXPORT WHERE (Price >= 100) TO DATABASE("SalesInvt", "Sales");
Solvers use the branch and bound method to solve integer or mixed integer problems. The subsequent branch and bound tree generated in a solve can be vast often depending on the model complexity and number of discrete variables. Strategies to fine tune the search and reduce the possible number of traverses can dramatically improve performance time.
On a modeling standpoint it is always advisable to have model formulation that has good bounds on the variables and the constraints are formulated as tight as possible. Often one may need to try different modeling approaches it may also help in some cases adding in global cuts to the model. These simply are unnecessary constraints that have no inherent use in the model but can reduce the convex hull of the relaxed LP of the problem.
Solving large or difficult MIPs it is always advised to use the industrial strength solvers such as CPLEX or XPRESS. They have numerous algorithmic features that generally solve these kinds of problems more efficiently than other solvers. Solvers allow one to choose MIP search strategies by setting various parameters, which can have an enormous impact.
There are no general steadfast rules on which settings one should use for solving MIPs. One has to use some trail and error in setting these options for a specific model type. Upon our experience we find that having aggressive cut strategies, moderate probing and using special branching strategies such as strong branching or pseudo-cost based branching generally achieves the best results.
Tolerance related to optimality comes into play when solving integer-programming problems. These settings are used as a stopping procedure. Finding optimal solutions for these problems can be an exhaustive process, these tolerance settings allows one to halt the solving run when a good solution is found rather than continuing the search in order to find a better solution if it exists.
There are two optimality tolerance settings: Relative and Absolute Gap.
The relative gap is the setting that allows the solving process to be halted if the best solution found is within a percentage of the upper most bound (LP relaxation of the best remaining node), eg: 0.1 indicates that the search process can stop if a solution is found to be within 0.1% of the best bound.
The absolute gap is the gap that one allows between the best integer solution found so far and the upper most bound. eg: 0.5 indicates that the search process can stop if the best integer solution is found to be within 0.5 of the best bound.
One can set the absolute tolerance to be zero and the relative gap to be a tiny percentage in order to solve to optimality.
To only display the nonzero values in the solution file. Go into Options | Solution File Options Check the "Nonzero values Only" option. This will only display variable values that are nonzero.
Exporting to a database using the REFILL command and using the EXCELSPARSE command will always only export the nonzero values of the variables.
These are of extreme importance in nonlinear programming and can greatly enhance the solution if good starting values are selected.
To define the initial values for variable one uses the keyword INITIAL just after the variable definition followed by the value which can be data vectors.
VARIABLE Produce[product] INITIAL MaxProduction;
IF no initial point is stated then the solver used will automatically determine from which point to start the search from, often this will be the lower bound, zero or the upper bound.