Display the model in Java

47 views
Skip to first unread message

Emmanuel Seve

unread,
Mar 10, 2022, 3:52:29 AM3/10/22
to or-tools-discuss
Hi all,

Is there a way in java to display the model created in a LP format for example or something else ?

I tried this code inspired by the python command but it does not work:

String model_as_string = solver.exportModelAsLpFormat();
System.out.println("model_as_string: " + model_as_string);


The function "exportModelAsLpFormat" is not known apparently. 
Or least with this syntax.

Thanks in advance

Emmanuel

Laurent Perron

unread,
Mar 11, 2022, 4:03:58 AM3/11/22
to or-tools-discuss
See in examples/tests/LpSolverTest.java

final MPModelExportOptions obfuscate = new MPModelExportOptions();
obfuscate.setObfuscate(true);
String out = solver.exportModelAsLpFormat();
assertThat(out).isNotEmpty();
out = solver.exportModelAsLpFormat(obfuscate);
assertThat(out).isNotEmpty();
out = solver.exportModelAsMpsFormat();
assertThat(out).isNotEmpty();
out = solver.exportModelAsMpsFormat(obfuscate);
assertThat(out).isNotEmpty();
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00



--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/79a5452c-944d-4220-b86d-dd4f44552227n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages