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
By clicking on a file name, a preview is opened at the bottom of this page.
Callback.java[download]





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(DefaultMessageListener::console);

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

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

Back to examples browserPrevious exampleNext example