coin-or / CoinMP

C-API library for CLP, CBC, and CGL
Other
19 stars 10 forks source link

Dll Parameters #17

Open MR-CDSID opened 5 years ago

MR-CDSID commented 5 years ago

I'm a new user of Clp and I didn't found any user guide that explains the Dll functions, can someone help me? I didn't understand very well the paramenters: RangeValues, MatrixBegin, MatrixCount, MatrixIndex, MatrixValues. I was using another Linear programming solver and I'm trying to change to Clp. Thanks.

tkralphs commented 5 years ago

What LP solver are you currently using? These parameters are very similar to the ones that other LP solvers would use, so there is probably a way to map what you're already doing pretty easily. What specific functions are you trying to use? You might find some hints in the Doxygen documentation: https://www.coin-or.org/Doxygen/Clp/

To figure out the mapping, you could also compare the OsiSolverInterface implementations of the various solvers.

MR-CDSID commented 5 years ago

I'm currently using LP Solve. I'm trying to use Clp in Delphi, so I'm calling the functions in a explicit way:

First I do: lp = Loadlibrary('CoinMP.dll'); //lp is a THandle I also call the function to create a problem.

So I try to load the problem doing: GetProcAddress(lp, 'CoinLoadProblem');

Until this part everything is working very well.

However when I call the function bellow, it appears a message saying "Access violation at 0x0d43fe5a: write of address 0x000a0ff8"

TCoinLoadProblem = function(HPROB: pointer; ColCount: integer;
  RowCount: integer; NonZeroCount: integer; RangeCount: integer;
  ObjectSense: integer; ObjectConst: double; ObjectCoeffs: Pdouble;
  LowerBounds: Pdouble; UpperBounds: Pdouble; RowType: Pchar;
  RHSValues: Pdouble; RangeValues: Pdouble; MatrixBegin: Pinteger;
  MatrixCount: Pinteger; MatrixIndex: Pinteger; MatrixValues: Pdouble;
  ColNamesList: Pstring; rwNamesList: Pstring ; objName: Pstring): integer;

I saw an example and I could understand more about the parameters, but I didn't see why that problem is happening. I'm confused because I don't know if the problem is a wrong parameter or the way I'm defining the function.

//I defined a pointer of some variables as Pdouble or Pinteger... Are you able to help me? Thank you for answering.