Setting up Eclipse for Java API of IBM ILOG CPLEX

After installed IBM ILOG CPLEX Optimization Studio 12.6, I tried the instructions described in the IBM Knowledge Center to set up Java APIs for CPLEX and CP in Eclipse, but they do not work correctly. Here is what I did to build a java project with CPLEX  and CP Java APIs in Eclipse. These steps have been done in Eclipse on Window 7, not sure if it works for other Java IDEs or other OSs. It also assumes that the IBM ILOG CPLEX Optimization Studio has already been installed. Read More...

Join Multiple Excel Workbooks through Custom SQL Query in Tableau

Recently I came across the need of joining multiple excel files in Tableau. I did a hard research on how to do it. However, most of the instructions I found were about how to join two tabs(worksheets) in the same excel workbook. In this post, I will describe how to join multiple worksheets from different workbooks, which spent me about one hour to figure out. Please note the instructions here work for Tableau Desktop 9.0 or later. Read More...

Install and Run Jupyter (IPython) Notebook on Windows

To install Jupyter Notebook, there are couple of ways. One option is using the package management platforma, like Anaconda. If you don’t want use them, you can also try the installation directly through Python. You will need Python installed on your system. I assume that, like me, you already installed the newest Python package on your Windows system and now you want to install and use the Jupyter Notebook. In this post, I describe some steps you can follow to install the Jupeter directly from Python. Read More...

A Generic Comparator Class for Java Collections.sort()

Sort A List of Objects

As a Java programmer, I often need to sort a list of objects. If the object is a primitive type, such as String, Integer, Long, Float, Double, or Date, it is easy to use Collections.sort(). However, it is not easy to sort a list of user defined objects, which do not implement the Comparable interface, for example, a Person object, as defined below. If you want to sort a list of Person objects by id in ascending order, you hav to provide a Comparator class to encapsulate the ordering. One possible comparator class is defined below. Instead, a generic comparator class is defined in this post to sort lists of primitive as well as user defined objects, in any specified order and by any specified field(s). Read More...

Benefits of Constraint Programming

Constraints Programming (CP) is a relatively new, but evolving rapidly, paradigm in Operation Research. It was derived from Computer Science - Logic Programming, Graph Theory, and Artificial Intelligence. Like a Mathematical Programming (MP), such as Linear Programming, Integer Programming, or Nonlinear Program, CP works with the same concepts of decision variables, constraints, and/or objective function. Because of its flexible modeling language and powerful search strategy, CP is a powerful and easy-to-use optimization technology to solve highly combinatorial optimization problems, such as scheduling problems, timetabling problems, sequencing problems, and allocation or rostering problems. These problems might be difficult to solve for traditional MP, due to: 1) constraints that are nonlinear in nature; 2) a con-convex solution space that contains many locally optimal solutions; 3) multiple disjunctions, which result in poor information returned by a linear relaxation of the problem. This post tries to summarize some major benefits of CP in contrast with MP models in modeling and solving standpoints. Read More...