Originally posted by: SystemAdmin
[mnaiman said:]
Hello,
I am having problem invoking the cplex library to load the linear programming problem. The problem is generated in LP format by using a shell(...) command and zimpl as shown in the code. Now I want to load the file into cplex to perform optimization and get the solution. However, I am unable to do so and coming accross following problems.
If I use the firstcode... then it gives me the error... "Object reference not set to an instance of an object." and asks me to use NEW to Instantiate the object. which is understandable. So I change he code as shown in the second code.
-------
Imports ILOG.Concert
Imports ILOG.CPLEX
Imports System.Collections
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Shell("cmd.exe /c zimplopt RMh.txt", AppWinStyle.NormalFocus) ' to generate RMh.lp file in the same folder
Dim modelname As String = "C:\Backup old PC Jalil\MJalil\Data\Visual Studio 2008\Projects\CPLEXIMPORT\CPLEXIMPORT\bin\Debug\RMh.lp" ' assign filename to string
Dim CModel As Cplex
CModel.ImportModel(modelname) ' to load file
End Sub
End Class
-------
So I replace Dim CModel As Cplex ==> Dim CModel As New Cplex() as shown in the next code and it gives me the following error. "Unable to load DLL 'cplex110': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
-------
Imports ILOG.Concert
Imports ILOG.CPLEX
Imports System.Collections
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Shell("cmd.exe /c zimplopt RMh.txt", AppWinStyle.NormalFocus) ' to generate RMh.lp file in the same folder
Dim modelname As String = "C:\Backup old PC Jalil\MJalil\Data\Visual Studio 2008\Projects\CPLEXIMPORT\CPLEXIMPORT\bin\Debug\RMh.lp" ' assign filename to string
Dim CModel As New Cplex()
CModel.ImportModel(modelname) ' to load file
End Sub
End Class
-------
Any help is highly appreciated...
#CPLEXOptimizers#DecisionOptimization