我想知道这里是否有人使用 lpsolve 来解决线性规划问题。
我在一个有约束 x45=0 的文件中定义了一个整数线性规划问题(还有其他整数变量)。问题被lpsolve解决后,奇怪的报告结果是x45=1。但是,如果我在约束之前加上一个标签,例如 c1:x45=0,那么就会满足约束。这里有人知道发生了什么吗?
所以我在我的 LP 文件中定义的问题是:
max: 0 x0 262 x1 262 x2 262 x3 262 x4 262 x5 262 x6 262 x7 270 x8 0 x9 270 x10 270 x11 270 x12 270 x13 270 x14 270 x15;
549 x16 549 x17 0 x18 549 x19 549 x20 549 x21 549 x22 549 x23 >= 1;
603 x24 603 x25 603 x26 0 x27 603 x28 603 x29 603 x30 603 x31 >= 1;
x0=0;
x9=0;
x18=0;
x27=0;
x36=0;
x45=0;
x54=0;
x63=0;
x0=x0; x1=x8; x2=x16; x3=x24; x4=x32; x5=x40; x6=x48; x7=x56; x8=x1; x9=x9; x10=x17; x11=x25; x12=x33; x13=x41; x14=x49; x15=x57; x16=x2; x17=x10; x18=x18; x19=x26; x20=x34; x21=x42; x22=x50; x23=x58; x24=x3; x25=x11; x26=x19; x27=x27; x28=x35; x29=x43; x30=x51; x31=x59; x32=x4; x33=x12; x34=x20; x35=x28; x36=x36; x37=x44; x38=x52; x39=x60; x40=x5; x41=x13; x42=x21; x43=x29; x44=x37; x45=x45; x46=x53; x47=x61; x48=x6; x49=x14; x50=x22; x51=x30; x52=x38; x53=x46; x54=x54; x55=x62; x56=x7; x57=x15; x58=x23; x59=x31; x60=x39; x61=x47; x62=x55; x63=x63; x0 x1 x2 x3 x4 x5 x6 x7=1; x8 x9 x10 x11 x12 x13 x14 x15=1; x16 x17 x18 x19 x20 x21 x22 x23=1; x24 x25 x26 x27 x28 x29 x30 x31=1; x32 x33 x34 x35 x36 x37 x38 x39=1; x40 x41 x42 x43 x44 x45 x46 x47=1; x48 x49 x50 x51 x52 x53 x54 x55=1; x56 x57 x58 x59 x60 x61 x62 x63=1;
bin x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36,x37,x38,x39,x40,x41,x42,x43,x44,x45,x46,x47,x48,x49,x50,x51,x52,x53,x54,x55,x56,x57,x58,x59,x60,x61,x62,x63;
通过解决它,结果是:
Value of objective function: 532.00000000
Actual values of the variables:
x0 0
x1 0
x2 0
x3 0
x4 0
x5 0
x6 0
x7 1
x8 0
x9 0
x10 1
x11 0
x12 0
x13 0
x14 0
x15 0
x16 0
x17 1
x18 0
x19 0
x20 0
x21 0
x22 0
x23 0
x24 0
x25 0
x26 0
x27 0
x28 1
x29 0
x30 0
x31 0
x36 0
x45 1
x54 1
x63 0
x32 0
x40 0
x48 0
x56 1
x33 0
x41 0
x49 0
x57 0
x34 0
x42 0
x50 0
x58 0
x35 1
x43 0
x51 0
x59 0
x37 0
x44 0
x38 0
x52 0
x39 0
x60 0
x46 0
x53 0
x47 0
x61 0
x55 0
x62 0
如你看到的。x45 和 x54 都是 1,而其他约束都满足。如果我在约束之前放一个标签,例如:
c1: x45=0;
然后就会遇到。我不知道为什么这会有所不同