Posts

Simplex implementation in Java with sample code

Simplex is one of the powerful algorithm to solve linear programming problems. With simplex, we can maximise or minimise objective function with the given list of constraint. public class Simplex { private double[][] tableaux; // tableaux private int numberOfConstraints; // number of constraints private int numberOfOriginalVariables; // number of original variables private boolean maximizeOrMinimize; private static final boolean MAXIMIZE = true; private static final boolean MINIMIZE = false; private int[] basis; // basis[i] = basic variable corresponding to row i public Simplex(double[][] tableaux, int numberOfConstraint, int numberOfOriginalVariable, boolean maximizeOrMinimize) { this.maximizeOrMinimize = maximizeOrMinimize; this.numberOfConstraints = numberOfConstraint; this.numberOfOriginalVariables = numberOfOriginalVariable; this.tableaux = tableaux; basis = new int[numberOfConstraints]; for (int i = 0; i < ...

Tutorial on Connecting Java application to IBM DB2 Express-C edition (Windows)

Software Prerequisites ·           IBM DB2 Express-C ·           Java SE JDK To begin, we will need to write a Java App. An example is provided below, this app simply shows how to list all the lastname from Employee  table in Java app import java.sql.*; public class testing{  public static void main(String args[])  {        try       {              Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");              Connection con=DriverManager. getConnection("jdbc:db2: sample");              Statement stmt = con.createStatement();              ResultSet resultSet=stmt.executeQuery(" SELECT Lastname from Employee");              System.out.println("Got Results!");              while...

Tutorial on porting OpenCV(revision:5578) to android in Windows Environment

Image
Software Prerequisites svn client (eg.Tortoise SVN) ·          cmake tool   http://www.cmake.org/ ·          Android NDK (revision r5 or newer)   http://developer.android.com/sdk/ndk/index.html ·          OpenCV trunk   https://code.ros.org/svn/opencv/trunk/opencv      Additional requirements for Java wrapper and Android samples ·          SWIG   http://www.swig.org/ ·          JDK 5/JDK 6   http://www.oracle.com/technetwork/java/javase/downloads/index.html ·          Android SDK   http://developer.android.com/sdk/index.html ·          ant   http://ant.apache.org      Windows additional prerequisites At the moment OpenCV cross compilation under cy...