Forum Discussion
FICO
4 years agoCommunity Manager
Exception Thrown: 'System.BadImageFormatException' in xprsdn.dll
I am trying to use XPRESS optimizer using C# using Visual Studio. I found an example which I am trying to run. The code is given below.
using System;
using System.IO;
using Optimizer;
namespace XPRSExamples
{
class MipSolEnum
{
static void Main(string[] args)
{
XPRS.Init("");
XPRSprob prob = new XPRSprob();
prob.AddMsgHandlerCallback(Console.Out);
XPRSmipsolpool msp = new XPRSmipsolpool();
XPRSmipsolenum mse = new XPRSmipsolenum();
prob.MPSFormat = -1;
prob.ReadProb("hpw15");
int nCols = prob.Cols;
/* Avoid duplicated solutions from heuristics. */
msp.DuplicateSolutionsPolicy = 3;
/* Disable dual reductions to prevent dominated solutions from */
/* being presolved away. */
prob.MIPDualReductions = 2;
/* Run the enumeration */
int nMaxSols = 10;
mse.Minim(prob, msp, XPRSdefaultMipSolEnumHandler.GetDefaultHandlerCallback(), null, ref nMaxSols);
/* Print out the solutions found */
int nSols = mse.Solutions;
for (int i = 1; i <= nSols; i++)
{
int[] iSolutionId = new int[1];
double dObj;
int nSols2, nReturnedSolIds, solutionIdStatus;
mse.GetSolList((int)XPRSattribute.Mse_Metric_MipObject, i, i, iSolutionId, out nReturnedSolIds, out nSols2);
mse.GetSolMetric(iSolutionId[0], out solutionIdStatus, (int)XPRSattribute.Mse_Metric_MipObject, out dObj);
Console.WriteLine("--------\n" + i + " = " + dObj);
for (int j = 0; j < nCols; j++)
{
double[] dSol = new double[1];
int nValuesReturned;
msp.GetSol(iSolutionId[0], out solutionIdStatus, dSol, j, j, out nValuesReturned);
Console.WriteLine(j + " = " + dSol[0]);
}
}
XPRS.Free();
}
}
}I have added the xprsdn.dll in the references. But after running the code, it throws exception
Exception Thrown: 'System.BadImageFormatException' in xprsdn.dllHow do I resolve this?
Thanks!
1 Reply
- FICOCommunity Manager
Are you by any chance mixing up 64bit libraries with 3bit builds or vice versa?
Related Content
Related Content
How to download xprsdn.dll
Hello All, I am a new baby with this community. I want to use optimization technique in my .net based application. I don't have xprsdn.dll library. Can somebody of us help me to find out and send me...14 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum1 unread comment1 unread0Views0likes1CommentXPRBDN.dll, XPRSDN.dll Assembly version for .Net core v2.0
Hello, I am using the MIP solver, but I need a .Net core framework v 2.0 compliant binaries to make the project compatible for Linux, Mac and Windows. I can only find the assemblies compatible with ...8 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum1 unread comment1 unread0Views0likes1CommentXPRSmipoptimize - received signal SIGFPE, Arithmetic exception.
I am working on a program written in Pascal that's failing to optimize a MIP problem using XPRESS. The problem is created with XPRSloadmip and optimized with XPRSmipoptimize. In order to debug this ...3 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum10 unread comments10 unread0Views0likes10Comments