Ateji Newsletter - September 2008
Welcome to the second edition of Ateji's bi-monthly online newsletter!

OptimJ™ is becoming the language of choice for decomposing complex problems and integrating optimization models within larger IT environments. In the TECHNICAL CORNER, you will learn how model data can be read directly from any data source using standard Java™ APIs.

At Ateji we believe that optimization specialists deserve the same state-of-the-art tool support than mainstream programmers. Watch the VIDEO and enjoy the OptimJ user experience.

Ateji will attend SLE'08, the premier rendez-vous for advanced language technology. We look forward to meeting you in Toulouse.

-- The Ateji Team

Combining models and saving time with OptimJ

"I used OptimJ to implement a model for production planning in a polystyrene factory.", says Luc Mercier from Brown University. "The main program needed to call many times the IP solver, making the use of traditional modeling languages difficult. I would have used ILOG Concert™ Java API if I hadn't encountered OptimJ. What a time saver!"

Luc created Amsaa, an algorithm for online stochastic combinatorial optimization that scales thousands of time better than a multistage stochastic programming approach. He explains why he chose OptimJ:

"The code is several times more compact than the Concert equivalent, and definitely clearer. And there is no functionality loss since the underlying API is still available when needed (e.g., to use the solution pool). All in all, you get the expressiveness of OPL™ with the integrability and flexibility of Concert -- the best of both worlds."

PRODUCT NEWS

Full Eclipse™ editing support

OptimJ v1.3 features numerous performance improvements and full language-aware editing support under Eclipse, on par with the Java Development Environment.

Completion, automatic imports, code formatting, code navigation, will drastically improve your productivity. WATCH THE VIDEO

TECHNICAL CORNER

Connect to any data source

Stop losing your time writing boring interface code. OptimJ model data is read directly using standard Java APIs, such as: Any other Java API, whether standard or home-grown, can be used direcly as well. MORE>
News and Events

Full Eclipse editing support

At Ateji, we believe that optimization specialists deserve the same level of state-of-the-art tool support than mainstream programmers.

OptimJ v1.3 provides full language-specific editing support under the Eclipse IDE. State-of-the-art features such as completion, automatic imports and code formatting are available for optimization models and will dramatically improve your productivity. Enjoy the OptimJ user experience in this video:



International Conference on Software Language Engineering

Language engineering is changing the way the world writes programs.

SLE logo Together with CapGemini, OBEO and SIG, Ateji co-sponsors SLE'08 the 1st International Conference on Software Language Engineering (SLE) in Toulouse, September 29 and 30.

SLE is an international research forum that aims to bring together researchers and practitioners from both industry and academia to expand the frontiers of software language engineering.

Topics include model driven engineering, visual modeling languages, language tools and frameworks, language integration and transformation, and domain-specific languages. SLE'08 is co-located with MODELS'08.



Technical Corner

Connect to any data source

In this technical corner, we will see how OptimJ direct integration features help you:

  • stop losing your time writing boring interface code
  • concentrate on features with the highest added-value
  • not being dependent on the few data connectors provided by a single vendor



In a typical industrial project involving optimization techniques, time and effort devoted to optimization itself commonly amount to only 10% to 20% of the overall development time. Another 50% is devoted to integration, other parts such as graphic interfaces and general I/O making up the rest (see for instance the Cosytec whitepaper and Jan J. Bisschop's presentation at the GAMS workshop).

Part of application Percentage of overall size
Database/Integration 46%
Graphics 19%
Graphics libraries 14%
Problem solver 9%
I/O, dialog description 6%
Other 6%

Source: Cosytec whitepaper


Using OptimJ has been reported to shorten overall development times and improve productivity by up to 50% compared to classical "stand-alone" modeling languages. OptimJ language integration approach dramatically reduces integration efforts, enabling the developers to concentrate on parts with the highest added value.

An OptimJ model is nothing else than a particular kind of Java class. Parameter passing is done as usual via the class constructor, meaning that the input data can be read from any data source using any Java API, whether standard or home-grown. Model output (solutions) can be written to any data sink in the same way.

First, identify model parameters in the constructor:

public model DietModel solver lpsolve
{
/**
* This constructor takes the parameters of the model.
*/
public DietModel(
String[] VTMN,
String[] FOOD,
double[] cost,
float[] f_min,
float[] f_max,
float[] n_min,
float[] n_max,
float[][] amt)
{
... constructor body ...
}

... model body ...
}


Or even better, in a more object-oriented spirit, define a class containing the model parameters, and let the model constructor take an instance of this class as only parameter:

public class DietData
{
String[] VTMN,
String[] FOOD,
double[] cost,
float[] f_min,
float[] f_max,
float[] n_min,
float[] n_max,
float[][] amt)

... class body ...
}

public model DietModel solver lpsolve
{
/**
* All model parameters in a single instance of DietData.
*/
public DietModel(DietData params)
{
... constructor body ...
}

... model body ...
}


The following main method instanciates and solves the model:

public static void main(String args[])
{
DietData d = new ModelData(...);

// instanciate
DietModel m = new DietModel(d);

// extract
m.extract();

// and solve
if (m.solve()) {
... print the solution ...
}
}


Retrieving model data has been encapsulated within the constructor of the ModelData class. Below are some examples of constructors for common types of data sources.

Read model data from an Excel sheet using the Apache HFSS API

/**
* Instanciate model data from the given spreadsheet.
* An HSSFWorkbook is a handle to an Excel sheet.
*/
public ModelData(HSSFWorkbook wb)
{
VTMN = HSSFArea.make(wb, "Vitamins").toStringArray();
FOOD = HSSFArea.make(wb, "Foods").toStringArray();
cost = HSSFArea.make(wb, "Cost").toDoubleArray();
f_min = HSSFArea.make(wb, "FMin").toFloatArray();
f_max = HSSFArea.make(wb, "FMax").toFloatArray();
n_min = HSSFArea.make(wb, "VMin").toFloatArray();
n_max = HSSFArea.make(wb, "VMax").toFloatArray();
amt = HSSFArea.transpose(HSSFArea.make(wb, "Amount")
.toFloatArrayArray());
}

Read model data from an SQL database using the JDBC API

/**
* Instanciate model data from the given database.
* Parameter c is a handle to a database connection.
*/
public ModelData(Connection c) throws SQLException
{
// table Foods
int foods = rowcount("Foods");

FOOD = new String [foods];
cost = new double [foods];
f_min = new float [foods];
f_max = new float [foods];

Statement statement = c.createStatement();
ResultSet resultSet = statement.executeQuery(
"SELECT * FROM Foods");
statement.close();

int i = 0;
while(resultSet.next()) {
FOOD[i] = resultSet.getString("food");
cost[i] = resultSet.getDouble("cost");
f_min[i] = resultSet.getFloat("fmin");
f_max[i] = resultSet.getFloat("fmax");
i++ ;
}
resultSet.close();

// Similar code for tables Vitamins and Amount
...
}

Read model data using other APIs

Similar code can be written for any available data source using standard or home-grown APIs, and the input method can be changed easily without any modification in the model.

Code generators or middleware frameworks such as Hibernate can similarly be used in conjunction with an OptimJ model, as simply as with a standard Java program.

When graphical output is required, a graphical user interface designed using standard Java tools can be directly linked to the model. Additionally, user interaction is easily implemented using standard Java callbacks or events.

Get the source code

The full source code for these examples is provided with the OptimJ samples. You can browse them by downloading the free evaluation version of OptimJ.

 

SEO by AceSEF

whitepaper

Ateji sponsors SLE'08
Co-sponsored by CapGemini, OBEO, SIG and Ateji, the 1st International Conference on Software Language Engineering (SLE) is at forefront of language technology. MORE>

Academic licences
OptimJ academic licences are free for teaching at degree-granting institutions. Contact us.

Jobs
Ateji is hiring its OptimJ product manager.

Internships
Ateji is always welcoming interns (master level). Topics include language technology, Java development and marketing. International candidates welcome. Contact us.

Newsletter

To request a free subscription to our bi-monthly newsletter, enter your e-mail address below:
To prevent spam, please answer this little quiz: