ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface...
-
Upload
vanessa-day -
Category
Documents
-
view
220 -
download
2
Transcript of ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface...
![Page 1: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/1.jpg)
ILOG CPLEX introduction
Presenter: Meng-yen Li
![Page 2: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/2.jpg)
Outline• Introduction• Using the interactive interface• Read problem from file• LP format• Demo with FS problem
![Page 3: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/3.jpg)
Introduction
• ILOG CPLEX is an optimization package.• Usually shortened as “cplex”
• Named after Simplex method and C language.• Originally developed by Robert E. Bixby.• Now IBM has the acquisition of ILOG CPLEX.
• CPLEX was acquired by ILOG in 1997• ILOG was acquired by IBM in 2009
![Page 4: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/4.jpg)
Capability
• CPLEX can solve…• Very large linear programming problems(LP)• Mixed integer programming problems(MIP)• Quadratic objective programming problems(QP)• Quadratic constraint programming problems(QCP)
![Page 5: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/5.jpg)
Reference
• “ILOG CPLEX <Version> Getting Started”• Ref. - “ILOG CPLEX 11.0 Getting Started”, 2007• For CPLEX starter.
• “ILOG CPLEX <Version> File Formats”• Ref. - “ILOG CPLEX 10.0 File Formats”, 2006• For knowing file format detail, especially LP format.
• “ILOG CPLEX <Version> User’s Manual”• Ref. - “ILOG CPLEX 9.0 User’s Manual”, 2003• For manually using CPLEX Classes and Library in C++.
• You can get these documents by Google.• Current version is 12.1.0• Easy / Hard
![Page 6: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/6.jpg)
How to use
• CPLEX is currently installed on eda union 13• Login to edaunion.ee.ntu.edu.tw:40063• Just directly execute cplex
– Type cplex
• Unfortunately, the License is only for one user.• So if others are using or link dead when using,
you may see error message from ILM(license manager)
![Page 7: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/7.jpg)
Interactive Interface
r97160@edaU13:~$ cplexIBM ILOG License Manager: "ntu-taiwan " is accessing CPLEX 12 with option(s): "e
m b q use=1 MaintenanceEnd=20121031 ".
Welcome to CPLEX Interactive Optimizer 12.1.0 with Simplex, Mixed Integer & Barrier Optimizers5724-Y48 (c) Copyright IBM Corp. 1988, 2009. All Rights Reserved.CPLEX is a registered trademark of IBM Corp.
Type 'help' for a list of available commands.Type 'help' followed by a command name for moreinformation on commands.
CPLEX>
![Page 8: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/8.jpg)
Example with manually inputCPLEX> enter exampleEnter new problem ['end' on a separate line terminates]:maximize x1 + 2 x2 + 3 x3subject to -x1 + x2 + x3 <= 20x1 - 3 x2 + x3 <= 30bounds0 <= x1 <= 400 <= x20 <= x3end
![Page 9: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/9.jpg)
Example with manually inputCPLEX> enter exampleEnter new problem ['end' on a separate line terminates]:maximize x1 + 2 x2 + 3 x3subject to -x1 + x2 + x3 <= 20x1 - 3 x2 + x3 <= 30bounds0 <= x1 <= 400 <= x20 <= x3end
Keyword enter with problem name example
ProblemObjective Function maximize Subject to constraints subject toVariable bounds boundsend to finish input problem
![Page 10: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/10.jpg)
Solving the problemCPLEX> optimizeTried aggregator 1 time.No LP presolve or aggregator reductions.Presolve time = 0.00 sec.
Iteration log . . .Iteration: 1 Dual infeasibility = 0.000000Iteration: 2 Dual objective = 202.500000
Dual simplex - Optimal: Objective = 2.0250000000e+02Solution time = 0.00 sec. Iterations = 2 (1)
![Page 11: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/11.jpg)
View solutionCPLEX> display solution variables x1-x3Variable Name Solution Valuex1 40.000000x2 17.500000x3 42.500000
![Page 12: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/12.jpg)
Read problem from file
• Manually input is too tedious.• We can read the problem from file if it is
stored in LP format file.• You can read in many ways:
• read (then to be prompted to input file name)– example (then to be prompted to input file format)– lp
• read example lp (same to above but without prompt)• read example.lp (specify extension also works)
![Page 13: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/13.jpg)
LP format
Keyword abbreviation default name
enterread
er
by manually input(input filename)
maximizeminimize
maxmin
(obj)
subject to st (c1 …. cn)
bounds
end
![Page 14: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/14.jpg)
LP format: variable naming
• The variable name cannot be longer than 255 characters• All alphanumeric characters (a-z, A-Z, 0-9) and certain
symbols: ! " # $ % & ( ) , . ; ? @ _ ‘ ’ { } ~ can be used.• Any combinations are allowed except the followings.• Cannot start with numbers or period(.)• Cannot start with e/E with another number or e• (because e is reseverd for exponents and equal sense)• Some examples:
– O x123, x@#$ , #4x.3e, Example– X e2, eels, .123, 3x4
![Page 15: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/15.jpg)
LP format: constraint naming
• As previous table shows• The default name for objective function is obj.• The default name for constraints is c1 … cn.• You can change by adding labels before the linear
(in)eqaulities.• example:
max mymax: x1 + 2x2 + 3x3st time: -x1 + x2 + x3 <= 20 labor: x1 - 3x2 + x3 <= 30
![Page 16: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/16.jpg)
LP format: input limit
• Any line with more than 510 characters is truncated.• You can enter linear (in)equalities on separate lines, but
without cutting the variables.• example:
– correct inputtime: -x1 + x2 + <return>x3 <= 20 <return>labor: x1 - 3x2 + x3 <= 30 <return>
– incorrect inputtime: -x1 + x2 + x <return>3 <= 20 <return>labor: x1 - 3x2 + x3 <= 30 <return>
![Page 17: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/17.jpg)
LP format: sense
• X1 – 3x2 + x3 <= 30• Yellow part is called sense.• Blue part is called Right Hand Side(RHS).• CPLEX parse constraints by these key parts.• So if you add ; after a line(like c/c++) will get this warning.
– Warning, line 55: Characters after RHS value are ignored.
Sense =
Input format <= >= =
Synonym <, <=, =<, l(less) >, =>, >=, g(greater) =, e(equal)
Note < is interpreted as <= by cplex
> is interpreted as=> by cplex
![Page 18: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/18.jpg)
LP format: bounds• Variable bounds can enter as
– ln <= xn <= un• You can also separately enter the bounds
– ln <= xn – xn =< un
• Default setting– lower bound: 0– upper bound: +∞
• For infinity, set the bounds as +infinity(+inf) / -infinity(-inf)• also you can use free to indicate no bounds
– x7 free– same as –inf <= x7 <= +inf
![Page 19: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/19.jpg)
LP format: Integer
• Add section general/binary to list which variable is integer/0-1 integer.
• General/Generals/Gen is all acceptable.• Binary/Binaries/Bin is all acceptable.
![Page 20: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/20.jpg)
LP format:Mixed IntegerMaximize
obj: x1 + 2 x2 + 3 x3 + x4Subject To
c1: - x1 + x2 + x3 + 10 x4 <= 20c2: x1 - 3 x2 + x3 <= 30c3: x2 - 3.5 x4 = 0
Bounds0 <= x1 <= 402 <= x4 <= 3
Generalx4
Binaryx2
End
![Page 21: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/21.jpg)
Demo
• Using CPLEX to solve FS problem• Problem Input:
X0 X1 F
0 0 1
1 0 0
2 0 1
3 0 1
0 1 0
1 1 1
2 1 0
3 1 0
X0 X1 F
0 0 0
1 0 0
2 0 1
3 0 1
0 1 0
1 1 1
2 1 0
3 1 0
fsp1.lp(infeasible) fsp2.lp(has solution)
![Page 22: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/22.jpg)
Formulation
• FS constraint:• f(ma)f(mb) (ma[bit])(mb[bit])
• (ma[bit])(mb[bit])
| (ma[bit]) (mb[bit]) | 1
((ma[bit]) (mb[bit]) 1)
((mb [bit]) (m a[bit]) 1)
• At first I didn’t know how to write a Linear Constraint for this, so I wrote a Quadratic Constraint instead.
• | (ma[bit]) (mb[bit]) | 1
( (ma[bit]) (mb[bit]) )2 1
X F
1
ma a[0]
a[1]
a[2]
a[3]
0
1
mb b[0]
b[1]
b[2]
b[3]
1
0
0
![Page 23: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/23.jpg)
Convert constraints in MIQCPmin dummy
\x grc group/row/column\z grrc group/pairs of row/column\problem\x x0x1 encode f\0 0 0 x000 x001 x100 1\1 1 0 x010 x011 x100 0\2 2 0 x020 x021 x100 1\3 3 0 x030 x031 x100 1\4 0 1 x000 x001 x110 0\5 1 1 x010 x011 x110 1\6 2 1 x020 x021 x110 0\7 3 1 x030 x031 x110 0
Use dummy variable for there’s no objective function
Use \ to comment a line
This problem is infeasible.And if this bit changes to 0It will become feasible
![Page 24: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/24.jpg)
Convert constraints in MIQCPst\full symmetry property\pair01FSpair01: [ x000 * x000 + x000 * x001 + x000 * x100 - x000 * x010 - x000 * x011 - x000 * x100 + x001 * x000 + x001 * x001 + x001 * x100 - x001 * x010 - x001 * x011 - x001 * x100 + x100 * x000 + x100 * x001 + x100 * x100 - x100 * x010 - x100 * x011 - x100 * x100 - x010 * x000 - x010 * x001 - x010 * x100 + x010 * x010 + x010 * x011 + x010 * x100 - x011 * x000 - x011 * x001 - x011 * x100 + x011 * x010 + x011 * x011 + x011 * x100 - x100 * x000 - x100 * x001 - x100 * x100 + x100 * x010 + x100 * x011 + x100 * x100 ] >= 1 \this is the infeasible one’s FS QC(quadratic constraint) for example, other QC are omitted\Quadratic terms must put inside of square brackets []
![Page 25: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/25.jpg)
Convert constraints in MIQCP\x0 encode\x0 pair 01ENCODEx0bit0pair01LB: x000 + x010 - 2 z0010 >= -1ENCODEx0bit0pair01UB: x000 + x010 - 2 z0010 <= 0ENCODEx0bit1pair01LB: x001 + x011 - 2 z0011 >= -1ENCODEx0bit1pair01UB: x001 + x011 - 2 z0011 <= 0ENCODEx0pair01: 2 z0010 + 2 z0011 - x000 - x010 - x001 - x011 >= 1\(… from pair01 to pair23)\x1 encode\x1 pair 01ENCODEx1bit0pair01LB: x100 + x110 - 2 z1010 >= -1ENCODEx1bit0pair01UB: x100 + x110 - 2 z1010 <= 0ENCODEx1pair23: 2 z1010 - x100 - x110 >= 1 Cplex interpret > 0 as >= 0
here need change to >=1
![Page 26: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/26.jpg)
Convert constraints in MIQCPbindummy\x0x000 x001x010 x011x020 x021x030 x031\x1x100x110
\z0z0010 z0011z0020 z0021z0030 z0031
z0120 z0121z0130 z0131
z0230 z0231\z1z1010end Remember to add end at last line
![Page 27: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/27.jpg)
Use the interactive interfaceCPLEX> read fsp1.lpProblem 'fsp1.lp' read.Read time = 0.00 sec.CPLEX> display problem statsProblem name: fsp1.lpVariables : 24 [Binary: 24]Objective nonzeros : 1Linear constraints : 33 [Less: 13, Greater: 20] Nonzeros : 117 RHS nonzeros : 20Quadratic constraints: 16 [Greater: 16] Linear terms : 0 Quadratic terms : 256 RHS nonzeros : 16
![Page 28: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/28.jpg)
Use the interactive interfaceCPLEX> opt(…message too long so omitted here)MIP - Integer infeasible.Current MIP best bound is infinite.Solution time = 0.12 sec. Iterations = 350 Nodes = 68(Change the problem and rewrite constraints, store in fsp2.lp)CPLEX> r fsp2.lpCPLEX> opt(…message too long so omitted here)Solution pool: 1 solution saved.
MIP - Integer optimal solution: Objective = 0.0000000000e+00Solution time = 0.01 sec. Iterations = 37 Nodes = 0
Command needed not to type in full if the shortened one is not ambiguous.For example, read can also just type r.
![Page 29: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/29.jpg)
Use the interactive interfaceCPLEX> display sol var *Incumbent solutionVariable Name Solution Valuex100 1.000000x020 1.000000x031 1.000000x010 1.000000x011 1.000000(…other auxiliary z variables are omitted here)z1010 1.000000All other variables matching '*' are 0.
Shortened for commanddisplay solution variables ** is a wildcard character which meansany matching charactersthat is, display all variables
![Page 30: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/30.jpg)
Solution for FS
• CPLEX showed a solution to the problem– x100 x020 x031 x010 x011 are 1, others are 0
• We got the solution!X0 X1 Y
0 0 1 0
1 1 1 0
1 0 1 1
0 1 1 1
0 0 0 0
1 1 0 1
1 0 0 0
0 1 0 0
![Page 31: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/31.jpg)
Formulation
• But now I know how to formulate in Linear Constraint.• | x y | 1 ( (x-y) + M*b 1 ) ( (y-x) + M*(1-b) 1 )
( (x-y) + M*b 1 ) ( (y-x) - M*b 1-M )• x, y +Integer, b Binary, M is a large enough +integer.• Because |x-y| Max(x, y) (∵ x, y +Integer)• Let M = #bit + 1
![Page 32: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/32.jpg)
FS in Linear Constraint\full symmetry property\#bit =3, M=4FSpair02p: x000 + x001 + x100 - x020 - x021 - x100 + 4 fs02 >= 1FSpair02n: x020 + x021 + x100 - x000 - x001 - x100 - 4 fs02 >= -3
FSpair03p: x000 + x001 + x100 - x030 - x031 - x100 + 4 fs03 >= 1FSpair03n: x030 + x031 + x100 - x000 - x001 - x100 - 4 fs03 >= -3
FSpair05p: x000 + x001 + x100 - x010 - x011 - x110 + 4 fs05 >= 1FSpair05n: x010 + x011 + x110 - x000 - x001 - x100 - 4 fs05 >= -3
![Page 33: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/33.jpg)
FS in Linear ConstraintCPLEX> r fsp3.lpProblem 'fsp3.lp' read.Read time = 0.00 sec.CPLEX> dis pro staProblem name: fsp3.lpVariables : 39 [Binary: 39]Objective nonzeros : 1Linear constraints : 63 [Less: 13, Greater: 50] Nonzeros : 275 RHS nonzeros : 50
Variables : Min LB: 0.000000 Max UB: 1.000000Objective nonzeros : Min : 1.000000 Max : 1.000000Linear constraints : Nonzeros : Min : 1.000000 Max : 4.000000 RHS nonzeros : Min : 1.000000 Max : 3.000000
![Page 34: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/34.jpg)
FS in Linear ConstraintCPLEX> optTried aggregator 1 time.(…)Root node processing (before b&c): Real time = 0.01Parallel b&c, 8 threads: Real time = 0.00 Sync time (average) = 0.00 Wait time (average) = 0.00 -------Total (root+branch&cut) = 0.01 sec.
Solution pool: 1 solution saved.
MIP - Integer optimal solution: Objective = 0.0000000000e+00Solution time = 0.01 sec. Iterations = 60 Nodes = 0
![Page 35: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/35.jpg)
FS in Linear ConstraintCPLEX> dis sol var *Incumbent solutionVariable Name Solution Valuex000 1.000000x001 1.000000x021 1.000000x030 1.000000x110 1.000000(…)All other variables matching '*' are 0.
![Page 36: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/36.jpg)
Solution for FS
• CPLEX showed another solution to the problem– x000 x001 x021 x030 x110 are 1, others are 0.– It’s in fact a complement encoding compare to QCP’s.
X0 X1 Y
0 0 1 0
1 1 1 0
1 0 1 1
0 1 1 1
0 0 0 0
1 1 0 1
1 0 0 0
0 1 0 0
X0 X1 Y
1 1 0 0
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
0 0 1 1
0 1 1 0
1 0 1 0
solution from QCP formulation solution from LP formulation
![Page 37: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/37.jpg)
FS: maxmize multivalue f
• Problem Input:
X F
0 0
1 1
2 2
3 3
4 0
5 2
6 2
7 0
fsp5.lp(both function FS feasible)
X F
0 2
1 1
2 2
3 3
4 0
5 2
6 2
7 0
fsp6.lp(both function FS feasible)
![Page 38: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/38.jpg)
Problem Encoding
• X variables: x[minterm][bit]• example : x71 means 7-th minterm’s “1-th” bit• All start from 0!
• Y variables: b[minterm][bit]
![Page 39: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/39.jpg)
Formulation
For each pair of two minterm row of X.If Y-multivalue same, skip. Add LP constraint of
b-encoding not samesummation not same
Min m0+m1+…\b00 + b10 - 2z >= -1\b00 + b10 - 2z <= 0\2z - b00 - b10 >= 1 = ...\sum2 - sum3 +Mfs +(1-...) + m0>=1\sum3 - sum2 +M(1-fs)+(1-...) + m0>=1
![Page 40: ILOG CPLEX introduction Presenter: Meng-yen Li. Outline Introduction Using the interactive interface Read problem from file LP format Demo with FS problem.](https://reader037.fdocuments.us/reader037/viewer/2022102818/56649ea95503460f94bad97f/html5/thumbnails/40.jpg)
Thank you.