Forum Discussion
FICO
4 years agoCommunity Manager
Memory Problem with Xpress 8.12.3 (.Net C#) on Linux Machine
Hello,
We are facing Memory Issues with Xpress when using on Linux Machine.
We are using Xpress version 8.12.3 with the .net C# interface.
When running on a windows machine memory is released and GC is collecting memory used by Xpress.
When using Linux machine memory used by Xpress is not released efficiently and we are getting memory exceptions (out of memory).
We are running multiple models in iterations. We initialize the solver once and create new models using the same solver.
Initialize code.
private void InitializeOEMLicense()
{
int OEMval = 0;
string OEMmsg = "";
bool needLicense = XPRS.BeginLicensing();
try
{
if (needLicense)
{
XPRS.License(ref OEMval, ref OEMmsg);
OEMval = xxxxxxxxxxxxxxxxxx;
if (XPRS.License(ref OEMval, ref OEMmsg))
{
this.logger.LogInformation(OEMmsg);
}
else
{
this.logger.LogInformation("Xpress development software detected");
}
}
int err = XPRB.init();
if (err != 0)
this.logger.LogInformation("failed to initialize Xpress-BCL (code " + err + ")");
}
catch (XPRSException e)
{
this.logger.LogInformation("ERROR: Couldn’t license optimizer");
this.logger.LogInformation(XPRS.GetLicErrMsg());
}
finally
{
XPRS.EndLicensing();
}
}
Release code
private void FreeOEMLicense()
{
XPRS.BeginLicensing();
try
{
XPRB.free();
}
finally
{
XPRS.EndLicensing();
}
}
Code for creating a new model.
using (XPRBexprContext ctx = new XPRBexprContext())
{
var bclProblem = new XPRBprob(problemName);
var optimizerProblem = bclProblem.getXPRSprob();
.....
}
Model Dispose code
protected virtual void Dispose(bool disposing)
{
if (this.disposed)
return;
if (disposing)
{
// Managed resources
this.Variables.Clear();
this.Constraints.Clear();
this.Expressions.Clear();
this.InitialSolVariables.Clear();
this.Objective = null;
}
// Xpress problems
this.optimizerProblem.Dispose();
this.bclProblem.Dispose();
this.disposed = true;
this.logger.LogInformation($"Disposed model {this.ProblemName}");
}Please tell us if we are missing something.
Thanks,
Shamsher
2 Replies
Related Content
Related Content
GPU implementation: Trying to solve a MILP problem with PDHG and GPU in an AWS machine.
I get this log: "GPU support is not available for the hybrid gradient algorithm in the deterministic concurrent LP solver. The CPU version will be used instead." Am I doing something wrong or the PD...9 months agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum6 unread comments6 unread0Views0likes6CommentsMemory usage when repeatedly solving a problem
I want to solve for a facility problem the corresponding transport problems by enumerating all possible combinations of the binaries (12 DCs, so 2^12 combinations) - I need the optimal flows and cost...3 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum6 unread comments6 unread0Views0likes6CommentsXpress ignores memory limits
I'm running a Mip model through Xpress 9.2.5, python interface. Halfway the solve, the solve process is killed due to an out-of-memory error: Out of memory: Killed process 5270 (python) I tried impo...2 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum1 unread comment1 unread0Views0likes1Comment