You are on page 1of 10

BASF Uses a Framework for Developing

Web-Based Production-Planning-
Optimization Tools
Young M. Lee E. Jack Chen
IBM T.J. Watson Research Center, PO Box 218, Route 134, Yorktown Heights, New York 10598
BASF Corporation, 3000 Continental Drive North, Mount Olive, New Jersey 07828
ymlee@us.ibm.com chenej@basf-corp.com
This paper was refereed.

We developed a computational framework for delivering practical production-planning-


optimization tools on BASF Intranet. The framework enables users with Web browsers to
access complex optimization tools to interactively compute optimal production plans on any
computer platform. We formulated a MILP (mixed-integer linear programming) production-
planning-optimization model for one of BASFs chemical manufacturing plants and built a
generic infrastructure for integrating optimization engines and the Internet using server-side
Java programming. This framework has changed the way BASF implements and deploys
mathematical modeling tools.
(Industries: chemical, production-planning. Programming: integer, linear.)

T he World Wide Web (WWW) has become one


of the most important information sources and
communication platforms in industry and has experi-
called CrunchServer (Krieger 1997), which provides
thermodynamics data to process engineers through the
BASF Intranet, which allows Intranet users to run an
enced tremendous growth since its introduction in the optimization model remotely. Many have responded
early 1990s (Paxson and Floyd 1997). The Web, or the enthusiastically to those applications.
Internet, is a loose coupling of thousands of networks Via the Web, it is now possible to deliver compu-
and millions of computers around the globe. It has tational services that were once available only to
grown rapidly for several reasons, including a single those employees with specialized computer training
user-interface paradigm, its distributed architecture, and access to special computers and tools. Web-based
and the growth of open standards (Cohen et al. 2001). computational applications can be accessed from vir-
Many companies now use the Web to communicate tually any Web browser on any computer anywhere
various types of information to corporate employees in the world at any time to perform complex com-
and external customers. In the chemical industry, for putational tasks. Optimization is one such computa-
example, corporate Web sites that allow customers to tional tool that can provide lots of benets when it is
purchase products and request related services are available on the Internet. Optimization has been used
common. Companies that do not provide e-commerce widely in industry for solving complex business prob-
support may lose competitive advantage. Interest is in- lems. BASF, for example, has been using MILP
creasing in using the Web for delivering interactive (mixed-integer linear programming) to optimize dis-
computational tools and as an environment for hosting tribution networks, production planning, and sched-
all sorts of enterprise applications. BASF, a chemical uling. However, until now, the users of such optimi-
manufacturer, developed a computational model zation applications had to have powerful computers

0092-2102/02/3206/0015$05.00 Interfaces, 2002 INFORMS


1526-551X electronic ISSN Vol. 32, No. 6, NovemberDecember 2002, pp. 1524
LEE AND CHEN
BASF

with special optimizing engines and other data inter- to change the objective functions and constraints of op-
face utilities. Many of the optimization models used timization models using a Web browser and to run
within BASF have been standalone applications and optimizations and view the results in HTML pages.
have lacked standard interfaces with other enterprise Users do not need to use FTP or TELNET protocols. In
applications, such as data-warehouse (DW) or our framework, the input and output presentations are
enterprise-resources-planning (ERP) systems. There- dynamically generated from a JSP (Java Server Page)
fore, it has been difcult to deploy such optimization that resides on a Web server. The Web is a client-server
tools to multiple users and to maintain the tools. Also, application; the client is a local computer and the
communicating optimization results among users has server is a remote host (computer). We use the term
not been easy. client to refer to local computers in a client-server ap-
With the optimization tools on the Web, virtually plication. The input data are taken from the clients and
anyone within the allowed community on the Internet passed to the application (optimization) server, where
or Intranet can access complex optimization tools with- an optimization model is executed remotely. Typically,
out any special hardware or software. It is now easy the server is a powerful, high-end computer. After the
to make optimization technology available to many optimization is complete, the results are passed from
people. The optimization engine can reside on only the server back to the client computers in the form of
one powerful server with enough computing resources a standard HTML document, which users can view on
(or in rare cases, a few servers). Moreover, a network the browser. The client computer could be any com-
of computers can serve as a parallel and distributed puter with a Web browser and Internet access.
processing server environment for solving computa- Todays enterprise systems can capture a vast amount
tionally intensive problems. Communicating the opti- of transaction data, but they lack the analytical tools
mization results among the users, especially among they need to examine the data and to help managers
business managers, engineers, and production plan- make optimal decisions (Fan et al. 2000). The concept of
ners, is easy, because the optimization results are a Web-based optimization tool is not new. Fourer and
stored in a centralized server and can be accessed by Goux (2001), Bhargava and Krishnan (1998), and
and presented to the users through a exible and pow- Bhargava et al. (1997) describe a variety of such tools
erful medium. Furthermore, maintaining a Web-based and systems that are available today. Several Web
optimization tool is much easier than maintaining tra- sites, such as www.sas.com, www.statware.com,
ditional optimization tools installed separately on each www.optamaze.com, www.mcs.anl.gov/neos, and
users computer. One can modify or enhance a Web- riot.ieor.berkeley.edu/riot provide capabilities for
based optimization tool on one server, and all the users Web-based optimization. One can also nd a number
can access the change immediately. Moreover, the Hy- of such online optimization tools at www.informs.org/
per Text Markup Language (HTML) page is a exible resources/computer_programs. We designed, imple-
medium that facilitates presentation of the optimiza- mented, and used an interactive Web-based optimiza-
tion results, for example, using graphic presentation of tion tool. Our framework can be generalized and is easy
input data and optimization results encourages in- to implement. We used it to solve a practical optimi-
sights, resulting in improved productivity. Optimiza- zation (MILP) problem, a production-planning optimi-
tion is particularly well suited to Internet innovations. zation for a chemical manufacturing plant.
Both the Optimization Technology Center of Argonne
National Laboratory and Northwestern Universitys
Network-Enabled Optimization System (NEOS) pro-
A Production-Planning Optimization
ject (Fourer and Goux 2001) have the mission of pro- for a Chemical Manufacturing Plant
viding optimization as an Internet resource. We deployed an optimization model of a production-
We have exploited the Web infrastructure to build planning problem (Lee and Selikson 2000) on the In-
integrated applications and to execute optimization tranet for one of BASFs chemical manufacturing
components remotely on the Web. They permit users plants. The plant has multiple production lines and

Interfaces
16 Vol. 32, No. 6, NovemberDecember 2002
LEE AND CHEN
BASF

produces hundreds of millions of pounds of chemicals use the Internet to share information with their sup-
per year. Each production line is a continuous process pliers and customers. They can use the Internet to col-
that operates 24 hours a day, 365 days a year except lect customer feedback for production planning. For
during maintenance when production is interrupted example, they can update the customer-order infor-
for a few days. The plant produces multiple product mation and demand almost in real time.
grades with different physical properties. When the
plant switches from one product to another in a pro-
System Architecture for Web-Based
duction line, the line will produce an off-grade product
for a few days until the process reaches a steady state
Optimization
and meets specications. BASF sells off-grade prod- Java technology has revolutionized computer use, and
ucts at much lower prices than products meeting spec- applications are increasingly developed in Java and
ications, so it wants to minimize the number of prod- Web-enabled. However, most optimization modeling
uct changeovers. Furthermore, it operates the plant at and optimization packages, such as ILOG OPL (Opti-
full capacity; therefore, it must have a well-planned mization Programming Language) and XPRESS-MP
product-changeover schedule to maintain overall pro- (by Dash Associates), are based on C and other tradi-
duction levels. Each production line can produce only tional programming languages. Thus, it was impossi-
certain product grades and has a minimum and max- ble to call those optimization subroutines from Java
imum production rate. The permanent storage tanks directly until recently. Fortunately, Java provides the
Java Native Interface (JNI), which allows Java to inter-
for the nished products have limited space, and tem-
face with other popular programming languages, such
porary storage space is costly. Each production line has
as C or C, Visual Basic, and Fortran, which can be
a minimum length for production campaigns during
interfaced with most optimization packages. We de-
which product changeovers are not permitted. The
veloped a framework for calling optimization subrou-
goal in planning production is to compute a produc-
tines from Java via JNI with Web browsers. Web
tion plan that minimizes the inventory-holding costs
browsers make it easy for novices to use many opera-
and product-changeover costs while satisfying all the
tions research tools.
customer demands for nished goods and the other
We deployed one production-planning-
process constraints.
optimization model using a three-tiered architecture
An enterprise system is intended to help companies
(Figure 1). The rst tier on the client side processes the
make intelligent business decisions by integrating all input data and presents the output data. The second
types of business information. To do that, a system tier is the Web server, which manages the server-side
should be able to coordinate activities across the or- processing and communicates with third-tier servers,
ganization and provide decision tools for decision such as the database server and the application server.
makers (Fan et al. 2000). Information generated in all The JSP and Java programs, the database system, and
of the business processes can be stored, integrated, and the optimization engine can all run on one server.
analyzed. Most companies have data-repository sys- However, for security and performance reasons, it is
tems, such as DW and ERP systems, which contain the better to run them in separate servers, for example, on
input data needed for the optimization, such as the a Web server, a database server, and an application
demand forecast, the inventory, and production ca- (optimization) server. Users can use a Web browser in
pacity. The optimization model can be set up to access the client computer to edit input data, invoke execu-
those data already available in the database system. tion of the optimization, and receive results via ordi-
The output results of the optimization model can also nary Web pages. The main implementations and pro-
be stored in these database systems and can be avail- cessing tasks are carried out on the server side. This
able for other enterprise applications. Consequently, framework provides the exibility of a programming
optimization applications can be integrated with other language in a production environment, and develop-
enterprise applications. Furthermore, companies can ers can customize connections among models, data

Interfaces
Vol. 32, No. 6, NovemberDecember 2002 17
LEE AND CHEN
BASF

modules in the system so that people with little knowl-


edge of mathematical modeling could operate the
optimization model. Users of the models control their
optimization goals, such as minimizing cost or maxi-
mizing prots, and constraints by changing the param-
eters in the user interface screen; however, they often
dont need to understand the mathematical models
and solver to use the model.
In any use of a client-server application, some local
client program is invoked to manage the communica-
tions. Client-server interactions are mediated by sev-
eral basic Web components: browser-based interpret-
Figure 1: In the three-tiered architecture of the Web-based optimization, ers for HTML pages, servers for hypertext transfer
several processes communicate. The user edits input data and invokes protocol (HTTP) requests and responses, and server-
the optimization via a standard Web interface in the client side. When the side connections to solvers via Java. The optimization
user selects an input file, the JSP will retrieve the information from the
process starts when users make an HTTP request for a
server and display those data in a tabular format. The user can easily
modify and update data in the server via the JSP and a Java servlet. When JSP from a client computer. JSP technology enables
the user invokes the optimization, a Java servlet will pass the information rapid development of dynamic Web applications that
to JNI, which in turn will pass it to C programs. The C interface program are platform independent. JSP separates the user in-
can call optimization engines directly. The optimization engine retrieves terface from content generation, making it possible to
and updates data according to prespecified instructions. Once the opti-
change the overall layout of the Web page without al-
mization is completed, the results can be displayed as HTML pages.
tering the underlying dynamic contents. Pekowsky
(2000) describes how JSP works with HTML in detail.
sources, and user interfaces. Programmers can embed The JSP program makes a connection to optimization
xed models or change or add models to the server input les via a Java servlet (JavaBean) and dynami-
dynamically. The success of this framework has cally displays the names of the optimization input data
tables associated with the model.
changed the way BASF implements and deploys math-
Using the input-le-selection screen, the user selects
ematical modeling tools.
one or more tables from the les, for example, pro-
Some optimization-service Web sites deliver Web-
duction demand for future months; then JSP generates
based optimization by providing FTP utilities; users
and displays an HTML page with those data. The data
upload their local model and data les to the host com-
are displayed in a tabulated format; values that can be
puters and remotely invoke the execution of the opti-
updated are displayed in text cells. Users can change
mization model. Some other optimization-service Web
the data by typing over the displayed data in the text
sites provide text boxes that allow users to edit their cell on the browser. When sent back to the server, the
models and data les in the server. These implemen- modied data updates the les through the JSP and a
tations are fairly easy and straightforward. However, servlet. Most solvers provide the option to decouple
they require users to know quite a bit about the opti- the model and data les. The high-level algebraic for-
mization model and the optimization engine to use the mulations describe optimization models in concise,
tools. symbolic formats, and an accompanying data le spec-
In industry, however, users of optimization tools ies the model instance to be solved. However, differ-
typically are not people trained in mathematics or op- ent solvers may require different formats for the model
timization. Therefore, to be useful, industrial optimi- and data les. A servlet will translate data from the
zation tools must be easy to use. In our implementa- browser into solver-specic formats. Moreover, some
tion, we had to provide a user-friendly interface and solvers provide the option to read in data from spread-
integrate Web forms and the embedded optimization sheets and databases based on the SQL queries in the

Interfaces
18 Vol. 32, No. 6, NovemberDecember 2002
LEE AND CHEN
BASF

optimization model. For example, the XPRESS- optimization subroutine library) (Dash Associates
Connect interfaces enable the optimization model to 2000). The interface C function can be built as a dy-
connect to a range of popular spreadsheets and data- namic linking library (.dll) in the Microsoft Windows
bases such as MS (MicroSoft) Excel, MS Access, and environment or as a shared object (.so) le in the UNIX
other ODBC (open database connectivity) data sources environment. The JNI is able to interface with those
(Dash Associates 2000). If solvers do not have the op- libraries.
tion to interface with spreadsheets and databases di- In a typical implementation of a C function
rectly, one can write a Java servlet to retrieve data from (Java_Xpress_optimize) that can be invoked by JNI,
databases, translate data into solver-specic formats, the name of the optimization model is passed in as
and write them to data les. It is also possible to re- a parameter. The C function calls the XPRESS-MP
trieve or update data from multiple databases using modeler and optimizer, processes the results, and
different access methods and protocols as long as they passes the objective function value back to the call-
are available on the network. ing procedure. The XPRESS-MP model( ) function
Once the user has updated the input data, the JSP call generates a matrix le that the XPRESS-MP pack-
program calls a servlet that runs a JNI (Java Native age uses to execute the optimization. The input data
Interface) with a C-based program, which in turn runs of the optimization model are read in during this
the optimization engine with an optimization model. process. The optimization model provides the nec-
The C-based program will initiate a command instruct- essary instructions internally regarding the interface
ing the optimization model to read in data from data with data sets or databases. The DISKDATA com-
les specied in the model and to bind the data with mand and XPRESS-Connect interfaces sections in the
predened variables before it initiates the optimization
XPRESS-MP user guide and reference manual con-
command. In XPRESS-MP, this is accomplished by
tain details (Dash Associates 2000).
the model(sProblem,GENERATE,0,&nModelError)
The C function Java_Xpress_optimize is completely
statement. Thus, the model and data are completely
independent from the content of the optimization
independent. On the other hand, different solvers may
model. Thus, this architecture is generalized and is not
have different model syntaxes; therefore, the model
specic to the production model using XPRESS-MP.
and solver are not completely independent. When the
The name of the optimization model is passed to the
optimization is completed, the results are updated to
C function through the parameter sProblem. Thus,
the output les. A JSP program then dynamically dis-
the C function can be used to execute any optimization
plays the selected output report tables to the users
browser as HTML pages. The user can select any tables model. The C function can also be modied to interface
and view the optimization results. When the user se- with other solver engines and model formats. Addi-
lects the output le of interest from the drop-down tional parameters can be added to provide solver
menu, for example, production schedule, a JSP gener- information.
ates and displays an HTML page with those data. A
downstream application uses the optimization results
to generate daily production schedules, hourly raw
Benets and Impact
material feed rates, and production reports, such as The production-planning model we implemented has
Gantt charts. 1,452 variables (308 binary variables) and 1,113 equa-
In the Web-based optimization framework for BASF, tions. The optimization usually takes a few seconds on
we used XPRESS-MP as the modeling and optimiza- a Sun/Solaris workstation, running Netscape Enter-
tion engine. However, the framework will work with prise Server. The response time depends on other fac-
other optimization packages as long as they have C- tors as well, such as the state of the application server
based optimization library. We developed a generic C and the load of network trafc. Before we imple-
function that interfaces with the XPRESS-MP optimi- mented the model, analysts took several days to plan
zation package through XMSL (the XPRESS-MP mod- a production schedule. The short response time of the
eler subroutine library) and XOSL (the XPRESS-MP integrated model has allowed the production plant to

Interfaces
Vol. 32, No. 6, NovemberDecember 2002 19
LEE AND CHEN
BASF

adjust its production schedule quickly to accommo- result is that lots of small computers work simulta-
date any sudden market changes. The quality of pro- neously on different parts of the analysis and contribute
duction planning has also improved. The planning to the effort of analyzing monstrous amounts of data. In
model has helped the production planners to reduce solving an MILP problem, for example, a main server
inventory and to improve BASFs use of production can generate suboptimization problems through the
and storage capacity. In addition, business managers branch-and-bound method, and several computers
in different locations are now able to view the results within the network can optimize the subproblems in par-
and make intelligent business decisions quickly. Since allel while the main server orchestrates the overall opti-
we implemented the Web-based architecture, mainte- mization strategy. Commercial optimization software,
nance and technical support of the model have become such as XPRESS-MP, can support such parallel-
much easier. We modify and enhance the tool in only processing architecture. Therefore, the marriage between
one server, and all the users can access the change im- Web-based optimization and parallel and distributed
mediately. Using the framework, we developed an- processing seems natural. We are planning to implement
other production-planning-optimization model for an- parallel and distributed computation in our Web-based
other BASF manufacturing plant at a different site with optimization framework in the near future.
minimal expense by sharing resources, such as the op- The Web-based optimization infrastructure we de-
timization engine, server, and data-interface utility. veloped is a generic framework that can be applied to
The availability of powerful operations research soft- a variety of optimization applications. The JNI inter-
face between the Java class and the C-Interface pro-
ware on the Internet or Intranet and the effectiveness
gram is generic and can be customized easily for other
of using mathematical models to solve practical prob-
Web-based computational applications. For instance,
lems will encourage managers on the production oor
the framework can be used for integrating discrete-
to reevaluate their legacy approaches with mathemat-
event and continuous-process simulation engines on
ical solutions.
the Internet. Luo et al. (2000) and Guru et al. (2000)
One of the benets of integrating the optimization
described their frameworks for such applications. At
engine with the Web is that we can easily implement
BASF, we plan to use this framework to deliver a va-
parallel and distributed processing capability into the
riety of optimization applications, such as optimiza-
infrastructure. So far, application of parallel processing
tion problems for production planning, scheduling,
has been limited. Until recently, parallel computers
distribution, transportation, and formulation on the
could be found only in research laboratories or large Web, thus spreading the optimization technology to
universities. Furthermore, system software to support wider corporate communities.
large-scale distributed processing remains scarce (Luo Once an operations research tool becomes available
et al. 2000). On the other hand, an inherent character- through the Intranet or Internet, it can be further in-
istic of the Web is its distributed processing nature. The tegrated with other enterprise applications. For ex-
Internet can emulate the parallel processing architec- ample, the input parameters of an optimization model
ture of expensive parallel hardware, while the Internet can be updated in databases regularly through some
protocol unies diverse networking technologies and other enterprise applications. End users of the opti-
administrative domains. A network of several com- mization tool do not need to modify the input data
puters within the Intranet or Internet can collaborate themselves. Moreover, the optimization results can be
to solve complex optimization problems, effectively stored in databases for other applications.
utilizing computers that may be unused otherwise.
University of California, Berkelys SETI (search for ex-
traterrestrial intelligence) project (and the SETI@home Conclusions
screen saver) enables idle home computers to get a The Internet provides inexpensive and ubiquitous
chunk of data from SETI data over the Internet, ana- communication and data access while operations re-
lyze that data, and report the results back to SETI. The search can support strategic and tactical decision making

Interfaces
20 Vol. 32, No. 6, NovemberDecember 2002
LEE AND CHEN
BASF

with the data (Sodhi 2001). The Web has experienced Zij insufcient storage space of product i in time
tremendous growth since its introduction. To exploit j (slack),
its ubiquitous nature, it is important to make applica- dijk production status of product i, in time j, in line
tions Internet accessible. We developed a generic com- k, dijk {0, 1}, and
putation framework for Web-based optimization using X1ijk, X1ijk product changeover (1 in, 1
server-side Java programming, and we developed and out), X1ijk, X1ijk {0, 1}.
deployed a practical production-planning- The constraints are
optimization model using the architecture. The Java- l
based technology allows distributed processing, uni- Ii,j1
k1
Pijk Iij Uij Zij
versal portability (and platform independence),
modularity, and accessibility, thus presenting the [demand]ij 0 i, j, (1)
chance for a commercial breakthrough and industrial n
success of distributed optimization tools. The Web is Pijk [max prod rate]k 0 j, k, (2)
becoming a popular platform for information, services, i1

and operations in industry, and it is now a portal that n


provides a common gateway for integrating the appli-
i1
Pijk [min prod rate]k 0 j, k, (3)
cations of an entire enterprise. This framework allows
the coupling of optimization models with external data Iij [max storage capacity]ij 0 i, j, (4)
sources to create complete, powerful, highly exible
applications. Because of its generic nature, the frame- Iij [min storage capacity]ij 0 i, j, (5)
work will help people to make more and more opti- Pijk [max prod rate]k [prod capability]ik
mization tools and other computational tools available
dijk 0 i, j, k, (6)
on the Web so that more practitioners can access the
tools from any computer on the Internet using a Web dijk di,j1,k X 1ijk X 1ijk 0 i, j, k, (7)
browser. Our successful implementation of this archi-
and
tecture has accelerated the pace with which BASF is
Web-enabling other applications. Pijk [min campaign vol]k dijk 0 i, j, k. (8)

Acknowledgments Here [prod capability]ik {0, 1} is production capa-


The authors thank Bob Daniel (Dash Optimization), Paul Selikson, bility of product i in line k, that is, if product i can be
Mary F. Haight (Interfaces), and the anonymous referees for their run on line k.
valuable comments, which greatly improved the quality of this pa-
The objective function is
per. Young M. Lee conducted his work for this paper while he was
at BASF, Mount Olive, New Jersey. m n m n
min [IC]i Iij j1
j1 i1
i1
[DC]i Uij
APPENDIX m n

Production-Planning-Optimization
j1 i1
{[SC]i [IC]i} Zij
Model l m n

A simplied MILP formulation for the problem is as


k1 j1 i1
[CC]i X 1ijk, (9)
follows.
The decision variables are where
Pijk amount of product i, in time period j, in [IC]i inventory holding cost of product i ,
line k, [DC]i unmet demand cost (penalty) of product i ,
Iij inventory amount of product i in time pe- [SC]i insufcient storage space cost (penalty) of
riod j, product i ,
Uij unmet demand of product i in time period j, [CC]i changeover cost,

Interfaces
Vol. 32, No. 6, NovemberDecember 2002 21
LEE AND CHEN
BASF

n number of products, int nModelError;


int rtcode;
m number of planning periods, and double objval;
l number of production lines. const char *sProblem;
Equation (1) is the material balance constraint, bal-
sProblem (*jEnv).GetStringUTFChars(jMsg, 0);
ancing the carryover inventory and production with (*jEnv).ReleaseStringUTFChars(jMsg, sProblem);
current-period inventory, demand, unmet demand,
setoptlog(mylog.lst);
and insufcient storage volume. Constraints (2) and (3)
ensure that the production rate is within the valid if (initxm(NULL, 0, 0)) error(XMSL Initialize
failed);
range. Equations (4) and (5) are constraints for the up-
if (initlz(NULL, 0)) error(XOSL Initialize
per and lower bounds of the storage space. Equation failed);
(6) forces the binary production status variable, dijk, to if (model(sProblem, GENERATE,0,&nModelError))
have the value 1 when product i is produced in time j error(Could not generate matrix file\n);
if (freexm()) error(Could not free xmsl\n);
in line k, and to have the value 0 otherwise, according if (input(sProblem)) error(Could not read MPS
to the input-data matrix [production capability]ik, file);
which indicates if product i can be produced in line k. if (minim( )) error(MINIM failed);
if (global()) error(GLOBAL failed);
Equation (7) balances the production status with prod- if (freexo()) error(Could not free xsol\n);
uct changeover; that is, X 1ijk will have the value 1 when if (initxm(NULL, 0, 0)) error(XMSL Initialize
production is switched to produce product i, and failed);
X 1ijk will have the value 1 when production is if (model(sProblem, REPORT,0,&nModelError)
! 1)
switched from product i in time period j in production printf(rtcode %d; nModelError %d\n,
line k. Constraint (8) ensures that the production vol- rtcode, nModelError);
ume is at least the minimum campaign volume, that if (freexm()) error(Could not free xmsl\n);

is, the minimum production volume if the product is getdpv(N_DOBJVL, &objval);


produced at any production cycle. Equation (9) is the
return(objval);
objective function that needs to be minimized, and it
has four components: the inventory carrying cost, an } /* Optimize */
unmet demand penalty, an insufcient storage pen-
alty, and a changeover penalty.
Java Native Interface
A generic JNI function interfaces with a library le
C function Java_Xpress_optimize
XpressOpt.dll (built with the code of
#include stdafx.h
Java_Xpress_optimize). The class name Xpress and
#include windows.h
#include stdio.h the procedure name Optimize are used to construct
#include xpressm.h the name of the C function, Java_Xpress_Optimize.
#include xpresso.h Eckel (1998) explains how to create JNI functions.
#include Xpress.h
#define GENERATE 1 package opt;
#define REPORT 2 public class Xpress {

BOOL APIENTRY DllMain(HANDLE hModule, public native double Optimize (String sProblem);
DWORD dwReason, void** lpReserved) { static {
return TRUE; try {
} System.loadLibrary(XpressOpt);
}
void error(const char *mess) {
catch (UnsatisfiedLinkError e) {
fprintf(stderr, Error: %s\n, mess);
System.out.println (e);
}
System.exit(1);
JNIEXPORT jdouble JNICALL } /* try and catch */
Java_Xpress_optimize(JNIEnv * jEnv, jobject jthis, } /* static */
jstring jMsg) { } /* XPRESS */

Interfaces
22 Vol. 32, No. 6, NovemberDecember 2002
LEE AND CHEN
BASF

Xpress.h Header File any Web page; for example, the hyperlink statement
A HREFopt.jsp?lenamepoly.mod Opti-
The C header le Xpress.h, is generated automatically
mize/A will execute the optimization model
with the javah jni Xpress command. The Xpress.h,
poly.mod.
xpressm.h and xpresso.h from the XPRESS-MP pack-
age header les must be included in the le containing %@ page import opt.XpressBean %
the C function. These header les provide the neces- jsp:useBean idxpressopt classopt.XpressBean
sary linkage between Java and C, C and XPRESS-MP. scopesession/
jsp:setProperty namexpressopt property*/
/* DO NOT EDIT THIS FILEit is machine generated
*/ html
#include jni.h headtitleOptimization/title/head
/* Header for class Xpress */ %
String modelfile
#ifndef _Included_Xpress request.getParameter(filename);
#define _Included_Xpress int len modelfile.length();
#ifdef __cplusplus modelfile modelfile.substring(0,len-4);
extern C { %
#endif
/* Production Scheduling Optimization Page. br
* Class: Xpress br
* Method: optimize pThe optimized value is % xpres-
* Signature: (Ljava/lang/String;)Ljava/lang/ sopt.opt(modelfile) %.p
String; /body
*/ /html
JNIEXPORT jdouble JNICALL Java_Xpress_optimize
(JNIEnv *, jobject, jstring); Online References
INFORMS Resources www.informs.org/Resources/
#ifdef __cplusplus
Computer_Programs
}
#endif Java developer.java.sun.com/developer/onlineTraining
#endif Neos Server for Optimization www.mcs.anl.gov/neos
PaperSuite 2.0 www.optamaze.com
Remote Interactive Optimization Testbed riot.ieor.Berkeley.edu/
JavaBean riot
SAS Institute www.sas.com/solutions/supplychain/demos/
A generic JavaBean instantiates the JNI dened in the index.html
Xpress class and invokes the function Optimize() to Servlet java.sun.com/products/servlet/2.1/
optimize the model dened in the parameter Statit tool set www.statware.com
sProblem:
References
package opt; Bhargava, H. K., R. Krishnan. 1998. The World Wide Web: Oppor-
import Xpress; tunities for operations research and management science. J.
Comput. 10(4) 359383.
public class XpressBean {
Xpress app new Xpress(); , , R. Mueller. 1997. Decision support on demand: Emerging
public double opt (String sProblem) { electronic markets for decision technologies. Decision Support
return app.Optimize(sProblem); Systems 19(3) 193214.
} Cohen, M., C. B. Kelly, A. L. Medaglia. 2001. Decision support with
} /* XPRESSBean */ Web-enabled software. Interfaces 31(2) 109129.
Dash Associates Limited. 2000. XPRESS-MP User Guide and Reference
Manual. Dash Associates Limited, Northants, U.K.
Java Server Page Eckel, B. 1998. Thinking in Java. Prentice-Hall, Englewood Cliffs, NJ.
Fan, M., J. Stallaert, A. B. Whinston. 2000. The adoption and design
The optimization JSP (opt.jsp) uses the JavaBean
methodologies of component-based enterprise systems. Eur. J.
XpressBean to execute the optimization model de- Inform. Systems 9 2535.
ned in the parameter lename. The JSP le Fourer, R., P. Goux. 2001. Optimization as an Internet resource. In-
opt.jsp can be activated by a hyperlink or a form in terfaces 31(2) 130150.

Interfaces
Vol. 32, No. 6, NovemberDecember 2002 23
LEE AND CHEN
BASF

Guru, A., P. Savory, R. Williams. 2000. A Web-based interface for based simulation optimization. Proc. 2000 Winter Simulation
storing and executing simulation models. Proc. 2000 Winter Conf., Orlando, FL, December 2000. IEEE Press, New York, 1785
Simulation Conf., Orlando, FL, December 2000. IEEE Press, New 1793.
York, 18101814. Paxson, V., S. Floyd. 1997. Why we dont know how to simulate the
Krieger, J. H. 1997. Integration hits software tools. Chem. Engrg. News Internet. Proc. 1997 Winter Simulation Conf., Orlando, FL, Decem-
75(40) 2632. ber 1997. IEEE Press, New York, 10371044.
Lee, Y. M., P. L. Selikson. 2000. Optimization of production planning. Pekowsky, L. 2000. JavaServer Pages. Addison-Wesley, New York.
Technical report, BASF Corporation, Mount Olive, NJ. Sodhi, M. S. 2001. A match made in heaven. OR/MS Today 28(1) 30
Luo, Y. C., C. H. Chen, E. Yucesan, I. Lee. 2000. Distributed Web- 33.

Interfaces
24 Vol. 32, No. 6, NovemberDecember 2002

You might also like