FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Adding the message callback in Java

Description
The examples demonstrates how to define a messaging callback for the Xpress Optimizer in Java.

callback_java.zip[download all files]

Source Files





Callback.java

import com.dashoptimization.*;

public class Callback {
    public void run(String model)
    {
        try (XPRSprob problem = new XPRSprob(null)) {
            problem.setIntControl (XPRS.LPLOG, 1);
            problem.addMessageListener(new DefaultMessageListener());

            problem.readProb (model);
            problem.lpOptimize ("");
        }
    }

    public static void main(String [] args)
    {
        String model = args.length == 0 ? "javatest" : args[0];
        Callback c = new Callback ();
        c.run (model);
    }
}

Back to examples browserPrevious exampleNext example