To
bring the power of your preferred solver
to your preferred programming environment
Q.1
Why use EZMod instead of AMPL or GAMS?
Q.2 Why use EZMod instead of calling
directly the solver callable libraries (dll)?
Q.3 How does EZMod bring new
perspectives?
| Q.1 Why use EZMod instead of AMPL or GAMS? |
- AMPL or GAMS are based on specialized programming
languages and are intend for prototyping phase. New AMPL and GAMS users should then learn
new programming languages in order to model and solve mathematical programming problems.
- On the other hand, the users of EZMod are
welcome to continue to work with their preferred programming environment, be it Microsoft
Visual Basic, VisualC++, Borland Delphi, C/C++ or C++ Builder, or any programming
environment that allows calls to DLLs or accepts Active X components.
- EZMod is not a new Programming language. EZMod is a
library of functions (DLL) or objects (Active X) that allows the user to specify the
structure and the data of an optimization problem, to access the resources of the solvers
(DLLs or executables) (currently CPLEX, XPRESS-MP and FRONTLINE SYSTEMS) and to recover
various results and statistics.
- EZMod enables Operations Research and
Management Science professionals as well as management consultants to combine with extreme
ease the flexibility of visual programming environments and the power of optimization
resources.
| Q.2
Why use EZMod instead of calling directly the solver callable libraries (dll)? |
- EZMod completely frees the Operations
Research and Management Science professionals, and management consultants from the
stringent requirements of the solvers such as heavy matrix problem description, the order
of problem statement, and the like. So the users of EZMod do not need to
be experts or even familiar with the technical details of the solvers they intend to use. EZMod
automatically takes care of all the interactions necessary with the solver to be used.
- EZMod offers the facility to easily and
intuitively state optimization problems, to solve them and get the solutions. The
statement of optimization problems can be made step by step in the most appealing order to
the user, rather than being obliged to follow the rigid requirements of the solver in use.
- With EZMod, Operations Research and
Management Science professionals need to work only with variable and constraint names that
are meaningful to them, rather than with the matrix and vector indices required by most
solver callable libraries.
- EZMod submits your problem, as you
formulated, to one of the following solvers of your choice: CPLEX, XPRESS-MP and FRONTLINE
SYSTEMS. This current list of supported solvers will be enlarged by adding other popular
software.
- EZMod also permits to switch from one
solver to another within the same application with extreme ease, if this need be.
- EZMod has a very important and useful
added main feature compared to the current solvers in the market: it can be used to solve Quadratic
Mixed-Integer Programming (QMIP) problems! With its most
economic and popular linearization method, EZMod is equipped to solve
large size QMIP problems efficiently.
- EZMod frees its user from the heavy
matrix problem description.
- EZMod submits transparently your problem
to one of the supported solvers. This allows a total flexibility in the implementation of
the mathematical model.
- EZMod allows the user to describe
mathematical problems step by step using problems name (or identifier), constants names
(or identifier) and variables names (or identifier).
| Q.3 How does EZMod bring new perspectives? |
- By making the modeling and solution process solver independent.
- By making the programming toolkit programming
environment independent.
- By simplifying the development of "Event-Based
Models". Such models are constructed dynamically as events, conditions and
parameters arise during runtime. For example, you can easily modify and extend your
problem's specification and data in response to a button-click event without worrying
about the impact of such modification on the problem formulation, for EZMod will
make all the required adjustments before submitting it to the solver.
Example to illustrate the question Q.3:
Consider the following LP problem:
Let us name it "LPExample" and identify it by <PbId>
Maximize:
n
S Ci.Yi
i=1
Subject to: m
Con(j): S Aij.Yi
= Bij
j = 1
... k i=1
LWi
< Yi < Upi (Continuous)
If
"Condition" (an event at runtime for example):
ADD to the objective function:
p
S Di.Xi
i=1
ADD to all the constrains the term: Eij.Xi
LWxi
< Xi < Upxi (Continuous) |
This model is subject to a condition that
adds a set of variables to the objective function and to all the constraints.
We let you think about the way to design an
application running this model and using the conventional tools.
We give you the solution with EZMod (Subroutine
"Condition").
Here is the code of the Visual basic subroutine that
describes this LP problem:
(Under C/C++ or Delphi adapt the syntax but keep the same EZMod functions)
' Defining the Problem
Identifier as Long and Public
Public PbId As Long
Private Sub GenerateModel(m As Integer, n As Integer, C, A, B)
' Defining indices
Dim i, j
As Integer
' Defining the returned status of the
functions as Long
'(available for almost functions)
Dim status As Long
' Opening the problem LPExample
PbId = ezmOpenPb("LPExample")
' Define the optimization criterion as
Maximize with
' returning the status
status = ezmOptCri(PbId, EZM_MAX)
' Describe the linear terms Yi of the
objective function
For i = 1 To n
status = ezmCCoef(PbId, "Y" & i, EZM_SET, C(i))
Next i
' Describe the constraints
For j
= 1 To k
' The sense of the constraints "Equal
..."
status =
ezmConType(PbId, "Con("&"j"&")", EZM_EQCON)
' The
right-hand side
status =
ezmBCoef(PbId, "Con("&"j"&")", EZM_SET, B(i,j))
' For every
Constraint The left-hand side (Yi, i = 1 ... m)
For i = 1 To m
status = ezmACoef(PbId, "Y" & i, "Con("&"j"&")", EZM_SET, A(i,j))
Next
i
Next j
' Specify the type and bounds
of the variables Yi
For i
= 1 To n
' as "continuous variables"
status = ezmVarType(PbId, "Y" & i, EZM_CONVAR)
' Specify the lower bound of the variables Yi
status = ezmLwCoef(PbId,
"Y" & i, EZM_SET, Lw(i))
' Specify the upper bound of the
variables Yi
status = ezmUpCoef(PbId, "Y" & i, EZM_SET,
Up(i))
Next
j
End Sub
' Under a specific condition, the
model must involve a new set of variables
' Here is the subroutine "Condition"
Private Sub Condition(p As Integer, D)
' Defining the returned status of the
functions as Long
Dim status As Long
' Add the Xi to the objective function
For i = 1 To p
status =
ezmCCoef(PbId, "X" & i, EZM_SET, D(i))
Next i
' Add the Xi to the all the constraints
For j
= 1 To k
' For every Constraint add Xi, i = 1 ... p)
For i = 1 To p
status = ezmACoef(PbId, "X" & i, "Con("&"j"&")", EZM_SET, E(i,j))
Next
i
Next j
' Specify the type and bounds
of the variables Xi
For i
= 1 To p
' as "continuous variables"
status = ezmVarType(PbId, "X" & i, EZM_CONVAR)
' Specify the lower bound of the variables Xi
status = ezmLwCoef(PbId,
"X" & i, EZM_SET, Lwx(i))
' Specify the upper bound of the
variables Xi
status = ezmUpCoef(PbId, "X" & i, EZM_SET,
Upx(i))
Next
j
End Sub
And that's all!
' Here is the subroutine to solve the
described LP problem
' It uses the same problem identifier (PbId) defined as Public
Private Sub Solve()
' Defining the returned status of the
functions as Long
Dim status As Long
' Test the condition
If Cond = TRUE Then
Condition(p, D)
' Solve the problem LPExample using CPLEX Solver
status = ezmSolve(PbId, EZM_LP, EZM_CPLEX)
End Sub
' Here
is the subroutine to get the solution of the LP problem
' It uses the same problem identifier (PbId) defined as Public
Private Sub Results()
' Defining the returned status of the
functions as Long
Dim status As Long
' Getting some results (The objective value,
and X1 value)
Text1.Text = CStr(ezmGetZ(PbId))
Text2.Text = CStr(ezmGetX(PbId, "X1"))
' Get the solution with all the parameters and
variables
' in a text file
status = ezmWritePb(PbId, "C:\PbSolution.txt")
End Sub |