min
=Z1+Z2+Z3
Z1=5*X11+7*X21+5*X31+4*X41+6*X51+5*X61+5*X71+3*X81+P1
Z2=5*X12+7*X22+5*X32+4*X42+6*X52+5*X62+5*X72+3*X82+P2
Z3=5*X13+7*X23+5*X33+4*X43+6*X53+5*X63+5*X73+3*X83+P3
Z1<唯圆=60Z2<=60
Z3<=60
N1=25*X11+36*X21+32*X31+15*X41+31*X51+28*X61+22*X71+12*X81
N2=25*X12+36*X22+32*X32+15*X42+31*X52+28*X62+22*X72+12*X82+25*X11*0.9+36*X21*0.9+32*X31*0.9+15*X41*0.9+31*X51*0.9+28*X61*0.9+22*X71*0.9+12*X81*0.9
N3=25*X13+36*X23+32*X33+15*X43+31*X53+28*X63+22*X73+12*X83+25*X12*0.9+36*X22*0.9+32*X32*0.9+15*X42*0.9+31*X52*0.9+28*X62*0.9+22*X72*0.9+12*X82*0.9+25*X11*0.81+
36*X21*0.81+32*X31*0.81+15*X41*0.81+31*X51*0.81+28*X61*0.81+22*X71*0.81+12*X81*0.81
N4=N3*0.9
N5=N3*0.81
W1=43.4754+N1
W2=31.7983+N2
W3=24.0045+N3
W4=20.7178+N4+Q
W5=17.4312+N5+Q
W1>指滑塌=150W2>=160W3>=170
W4>=180W5>=190
L1+L2+L3
>=
20
P1=0.66*Q^0.51*L1
P2=0.66*Q^0.51*L2
P3=0.66*Q^0.51*L3
@gin(P1)@gin(P2)@gin(P3)
但个人觉得似乎不太对,有可能的话用原题重让磨新提问
在VB里面“工程”菜单下面添加“添加模块”,打开对话框,找到路径:X:\Program Files\lingo80\Dll(X为驱动盘)下的“Lingd80.bas”,添加到VB中。在VB界面上设计Text1和Text2、芹段Command1。
编写语句:
Private Sub Command1_Click()
'------------------------
Dim nError As Long
Dim pLINGO As Long
Dim nPointersNow As Long
Dim cScript As String
Dim Apppath As String
Dim dStatus As Double
Apppath = "take" &Space(1) &Right(App.Path, Len(App.Path) - 2)
'------------------------
On Error GoTo ERROREXIT
pLINGO = LScreateEnvLng()
'------------------------
Dim x As Double, y As Double
x = Text1.Text
'------------------------
nError = LSsetPointerLng(pLINGO, x, nPointersNow)
nError = LSsetPointerLng(pLINGO, y, nPointersNow)
'------------------------
On Error GoTo ERROREXIT
nError = LSexecuteScriptLng(pLINGO, cScript)
'------------------------
dStatus = -1#
nError = LSsetPointerLng(pLINGO, dStatus, nPointersNow)
'------------------------
cScript = "SET ECHOIN 1" &Chr(10)
cScript = cScript &Apppath &"\LINGO1.lng" &Chr(10)
cScript = cScript &"GO" &Chr(10)
cScript = cScript &"QUIT" &Chr(10)
cScript = cScript &Chr(0)
On Error GoTo ERROREXIT
nError = LSexecuteScriptLng(pLINGO, cScript)
'------------------------
LScloseLogFileLng (pLINGO)
LSdeleteEnvLng (pLINGO)
'------------------------
Text2.Text = y
ERROREXIT:
End Sub
然后再吵森用lingo8.0编写代码(命名为LINGO1.lng,注意要保存为.lng文件):
model:
data:
x=@pointer(1)
enddata
y=x*2
data:
@pointer(2)=y
enddata
end
将.lng文件和VB代码放同一文件夹,即可运行VB控制Lingo的输入(本嫌碰誉程序是由VB的Text1输入x,由lingo完成y=2x计算,计算结果返回到VB中Text2)。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)