阴的成语-ire
function cplexbilpex
% Use the
function cplexbilp to solve a binary integer
programming problem
%
% The bilp
problem solved in this example is
%
Maximize x1 + 2 x2 + 3 x3 + x4
%
Subject to
% - x1 + x2 + x3 + 10 x4
<= 20
% x1 - 3 x2 + x3 <=
30
% x2 - 3.5x4 =
0
% Binary Integer
% x1 x2
x3 x4
%
--------------------
--------------------------------------------------
-
----
% File: cplexbilpex.m
%
Version 12.5
%
-----------------------
----------------------------------------------------
% Licensed Materials - Property of
IBM
% 5725-A06 5725-A29 5724-Y48 5724-Y49
5724-Y54 5724-Y55 5655-Y21
% Copyright IBM
Corporation 2008, 2012. All Rights Reserved.
%
% US Government Users Restricted
Rights - Use, duplication or
% disclosure
restricted by GSA ADP Schedule Contract with IBM
Corp.
%
------------------------------
-----------------------------------------
----<
br>
try
% Since cplexbilp
solves minimization problems and the problem
% is a maximization problem, negate the
objective
f = [-1 -2 -3 -1]';
Aineq = [-1 1 1 10;
1 -3 1
0];
bineq = [20 30]';
Aeq
= [0 1 0 -3.5];
beq = 0;
options = cplexoptimset;
stics = 'on';
[x, fval,
exitflag, output] = cplexbilp (f, Aineq, bineq,
Aeq, beq, ...
[ ], options);
fprintf ('nSolution status =
%sn', tatusstring);
fprintf ('Solution
value = %dn', fval);
disp ('Values =
');
disp (x');
catch m
disp(e);
end
end
function cplexlpex
% Use the
function cplexlp to solve a linear programming
problem
%
% The LP problem solved
in this example is
% Maximize x1 + 2 x2
+ 3 x3
% Subject to
% - x1
+ x2 + x3 <= 20
% x1 - 3 x2 + x3
<= 30
% Bounds
% 0 <= x1
<= 40
% 0 <= x2
% 0
<= x3
%
--------------------
--------------------------------------------------
-
----
% File: cplexlpex.m
%
Version 12.5
%
-----------------------
----------------------------------------------------
% Licensed Materials - Property of
IBM
% 5725-A06 5725-A29 5724-Y48 5724-Y49
5724-Y54 5724-Y55 5655-Y21
% Copyright IBM
Corporation 2008, 2012. All Rights Reserved.
%
% US Government Users Restricted
Rights - Use, duplication or
% disclosure
restricted by GSA ADP Schedule Contract with IBM
Corp.
%
------------------------------
-----------------------------------------
----<
br>
try
% Since cplexlp
solves minimization problems and the problem
% is a maximization problem, negate the
objective
f = [-1 -2 -3]';
Aineq = [-1 1 1; 1 -3 1];
bineq =
[20 30]';
lb = [0 0
0]';
ub = [40 inf inf]';
options = cplexoptimset;
stics = 'on';
[x, fval,
exitflag, output] = cplexlp ...
(f,
Aineq, bineq, [], [], lb, ub, [], options);
fprintf ('nSolution status =
%sn', tatusstring);
fprintf ('Solution
value = %fn', fval);
disp ('Values
=');
disp (x');
catch m
disp(e);
end
end
function cplexlsqbilpex
% Use
the function cplexlsqbilp to solve a constrained
least squares
% problem Some variables are
binary.
%
------------------
--------------------------------------------------
---
----
% File: cplexlsqbilpex.m
% Version 12.5
%
-----------------
--------------------------------------------------
----
----
% Licensed Materials -
Property of IBM
% 5725-A06 5725-A29
5724-Y48 5724-Y49 5724-Y54 5724-Y55 5655-Y21
% Copyright IBM Corporation 2008, 2012. All
Rights Reserved.
%
% US Government
Users Restricted Rights - Use, duplication or
% disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
%
------------
--------------------------------------------------
---------
----
try
C = [0.9501 0.7620 0.6153 0.4057
0.2311 0.4564 0.7919 0.9354
0.6068 0.0185 0.9218 0.9169
0.4859 0.8214 0.7382 0.4102
0.8912 0.4447 0.1762 0.8936];
d = [0.0578
0.3528
0.8131
0.0098
0.1388];
Aineq = [0.2027 0.2721
0.7467 0.4659
0.1987 0.1988
0.4450 0.4186
0.6037 0.0152
0.9318 0.8462];
bineq = [0.5251
0.2026
0.6721];
lb = 0.0 * ones (4, 1);
ub
= 1.0 * ones (4, 1);
options = cplexoptimset;
stics =
'on';
[x, resnorm,
residual, exitflag, output] = ...
cplexlsqbilp (C, d, Aineq, bineq, ...
[ ], [ ], lb, ub, [ ], options);
fprintf ('nSolution status = %sn',
tatusstring);
disp ('Values =');
disp (x');
disp ('resnorm
=');
disp (resnorm);
disp
('residual =');
disp
(residual');
catch m
throw
(m);
end
end
function
cplexlsqlinex
% Use the function
cplexlsqlin to solve a constrained least squares
problem
%
------------------
--------------------------------------------------
---
----
% File: cplexlsqlinex.m
% Version 12.5
%
-----------------
--------------------------------------------------
----
----
% Licensed Materials -
Property of IBM
% 5725-A06 5725-A29
5724-Y48 5724-Y49 5724-Y54 5724-Y55 5655-Y21
% Copyright IBM Corporation 2008, 2012. All
Rights Reserved.
%
% US Government
Users Restricted Rights - Use, duplication or
% disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
%
------------
--------------------------------------------------
---------
----
try
C = [0.9501 0.7620 0.6153 0.4057
0.2311 0.4564 0.7919 0.9354
0.6068 0.0185 0.9218 0.9169
0.4859 0.8214 0.7382 0.4102
0.8912 0.4447 0.1762 0.8936];
d = [0.0578
0.3528
0.8131
0.0098
0.1388];
Aineq = [0.2027 0.2721
0.7467 0.4659
0.1987 0.1988
0.4450 0.4186
0.6037 0.0152
0.9318 0.8462];
bineq = [0.5251
0.2026
0.6721];
lb = -0.1 * ones (4, 1);
ub
= 2.0 * ones (4, 1);
options = cplexoptimset;
stics =
'on';
[x, resnorm,
residual, exitflag, output] = ...
cplexlsqlin (C, d, Aineq, bineq, [ ], [ ], lb, ub,
[], options);
fprintf ('nSolution
status = %sn', tatusstring);
disp
('Values =');
disp (x');
disp ('resnorm =');
disp
(resnorm);
disp ('residual =');
disp (residual');
catch m
disp(e);
end
end
function cplexlsqmilpex
% Use the
function cplexlsqmilp to solve a constrained least
squares problem
% Some variables are
binary.
%
------------------
--------------------------------------------------
---
----
% File: cplexlsqmilpex.m
% Version 12.5
%
-----------------
--------------------------------------------------
----
----
% Licensed Materials -
Property of IBM
% 5725-A06 5725-A29
5724-Y48 5724-Y49 5724-Y54 5724-Y55 5655-Y21
% Copyright IBM Corporation 2008, 2012. All
Rights Reserved.
%
% US Government
Users Restricted Rights - Use, duplication or
% disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
%
------------
--------------------------------------------------
---------
----
try
C = [0.9501 0.7620 0.6153 0.4057
0.2311 0.4564 0.7919 0.9354
0.6068 0.0185 0.9218 0.9169
0.4859 0.8214 0.7382 0.4102
0.8912 0.4447 0.1762 0.8936];
d = [0.0578
0.3528
0.8131
0.0098
0.1388];
Aineq = [0.2027 0.2721
0.7467 0.4659
0.1987 0.1988
0.4450 0.4186
0.6037 0.0152
0.9318 0.8462];
bineq = [0.5251
0.2026
0.6721];
lb = [0.0 -0.1 0.0 -0.1];
ub = [1.0 2.0 1.0 2.0];
ctype =
'BCBC';
options =
cplexoptimset;
stics = 'on';
[x, resnorm, residual,
exitflag, output] = ...
cplexlsqmilp
(C, d, Aineq, bineq, ...
[ ], [ ], [ ], [ ], [ ], lb, ub, ctype, [ ],
options);
fprintf
('nSolution status = %sn', tatusstring);
disp ('Values =');
disp (x');
disp ('resnorm =');
disp (resnorm);
disp ('residual =');
disp
(residual');
catch m
throw
(m);
end
end
function
cplexlsqmiqcpex
% Use the function
cplexlsqmiqcp to solve a constrained least squares
problem
% Some variables are binary and
one constraint is quadratic.
% <
br>-----------------------------------------------
------------------------
----
% File:
cplexlsqmiqcpex.m
% Version 12.5
%
----------------------------------------------
-------------------------
----
%
Licensed Materials - Property of IBM
%
5725-A06 5725-A29 5724-Y48 5724-Y49 5724-Y54
5724-Y55 5655-Y21
% Copyright IBM
Corporation 2008, 2012. All Rights Reserved.
%
% US Government Users Restricted
Rights - Use, duplication or
% disclosure
restricted by GSA ADP Schedule Contract with IBM
Corp.
%
------------------------------
-----------------------------------------
----<
br>
try
C = [0.9501
0.7620 0.6153 0.4057
0.2311
0.4564 0.7919 0.9354
0.6068
0.0185 0.9218 0.9169
0.4859
0.8214 0.7382 0.4102
0.8912
0.4447 0.1762 0.8936];
d =
[0.0578
0.3528
0.8131
0.0098
0.1388];
Aineq = [0.2027 0.2721
0.7467 0.4659
0.1987 0.1988
0.4450 0.4186
0.6037 0.0152
0.9318 0.8462];
bineq = [0.5251
0.2026
0.6721];
lb = [0.0 -0.1 0.0 -0.1];
ub =
[1.0 2.0 1.0 2.0];
l = [0
0 0 0]';
r = 1;
Q = [1 0 0
0
0 1 0 0
0 0 1
0
0 0 0 1];
ctype = 'BCBC';
options =
cplexoptimset;
stics = 'on';
[x, resnorm, residual, exitflag,
output] = ...
cplexlsqmiqcp (C, d,
Aineq, bineq,[ ], [ ], l, Q, r, [ ], [ ], [ ],
...
lb, ub, ctype, [ ],
options);
fprintf
('nSolution status = %sn', tatusstring);
disp ('Values =');
disp (x');
disp ('resnorm =');
disp
(resnorm);
disp ('residual =');
disp (residual');
catch m
throw (m);
end
end
function cplexlsqnonneglinex
% Use
the function cplexlsqnonneglin to solve a
nonnegative least squares
% problem
%
------------------------------
-----------------------------------------
----<
br>
% File: cplexlsqnonneglinex.m
%
Version 12.5
%
-----------------------
----------------------------------------------------
% Licensed Materials - Property of
IBM
% 5725-A06 5725-A29 5724-Y48 5724-Y49
5724-Y54 5724-Y55 5655-Y21
% Copyright IBM
Corporation 2008, 2012. All Rights Reserved.
%
% US Government Users Restricted
Rights - Use, duplication or
% disclosure
restricted by GSA ADP Schedule Contract with IBM
Corp.
%
------------------------------
-----------------------------------------
----<
br>
try
C = [0.0372
0.2869
0.6861 0.7071
0.6233 0.6245
0.6344 0.6170];
d = [0.8587
0.1781
0.0747
0.8405];
Aineq = [0.2027 0.2721
0.1987 0.1988
0.6037 0.0152];
bineq = [0.5251
0.2026
0.6721];
options = cplexoptimset;
stics = 'on';
[x,
resnorm, residual, exitflag, output] = ...
cplexlsqnonneglin (C, d, Aineq, bineq,
[], [], [], options);
fprintf ('nSolution status = %sn',
tatusstring);
disp ('Values =');
disp (x');
disp ('resnorm
=');
disp (resnorm);
disp
('residual =');
disp (residual');
catch m
throw (m);
end
end
function
cplexlsqnonnegmilpex
% Use the function
cplexlsqnonnegmilp to solve a nonnegative least
squares
% problem. The variables are
binary.
%
------------------
--------------------------------------------------
---
----
% File:
cplexlsqnonnegmilpex.m
% Version 12.5
%
----------------------------------------
-------------------------------
----
%
Licensed Materials - Property of IBM
%
5725-A06 5725-A29 5724-Y48 5724-Y49 5724-Y54
5724-Y55 5655-Y21
% Copyright IBM
Corporation 2008, 2012. All Rights Reserved.
%
% US Government Users Restricted
Rights - Use, duplication or
% disclosure
restricted by GSA ADP Schedule Contract with IBM
Corp.
%
------------------------------
-----------------------------------------
----<
br>
try
C = [0.0372
0.2869
0.6861 0.7071
0.6233 0.6245
0.6344 0.6170];
d = [0.8587
0.1781
0.0747
0.8405];
Aineq = [0.2027 0.2721
0.1987 0.1988
0.6037 0.0152];
bineq = [0.5251
0.2026
0.6721];
ctype = 'BB';
options = cplexoptimset;
stics =
'on';
[x, resnorm,
residual, exitflag, output] = ...
cplexlsqnonnegmilp (C, d, Aineq, bineq, [], [],
[], [], [], ctype, ...
[],
options);
fprintf
('nSolution status = %sn', tatusstring);
disp ('Values =');
disp (x');
disp ('resnorm =');
disp
(resnorm);
disp ('residual =');
disp (residual');
catch m
throw (m);
end
end
function cplexlsqnonnegmiqcpex
% Use
the function cplexlsqnonnegmiqcp to solve a
nonnegative least squares
% problem. The
variables are binary and one constraint is
quadratic.
%
---------------
--------------------------------------------------
------
----
% File:
cplexlsqnonnegmiqcpex.m
% Version 12.5
%
----------------------------------------
-------------------------------
----
%
Licensed Materials - Property of IBM
%
5725-A06 5725-A29 5724-Y48 5724-Y49 5724-Y54
5724-Y55 5655-Y21
% Copyright IBM
Corporation 2008, 2012. All Rights Reserved.
%
% US Government Users Restricted
Rights - Use, duplication or
% disclosure
restricted by GSA ADP Schedule Contract with IBM
Corp.
%
------------------------------
-----------------------------------------
----<
br>
try
C =
[0.0372 0.2869
0.6861
0.7071
0.6233 0.6245
0.6344 0.6170];
d = [0.8587
0.1781
0.0747
0.8405];
Aineq = [0.2027 0.2721
0.1987 0.1988
0.6037 0.0152];
bineq = [0.5251
0.2026
0.6721];
ctype = 'BB';
l = [0 0]';
r = 1;
Q = [1 0
0 1];
options =
cplexoptimset;
stics = 'on';
[x, resnorm, residual, exitflag,
output] = ...
cplexlsqnonnegmiqcp
(C, d, Aineq, bineq, [], [], l, Q, r, ...
[], [], [], ctype, [], options);
fprintf ('nSolution status = %sn',
tatusstring);
disp ('Values =');
disp (x');
disp ('resnorm
=');
disp (resnorm);
disp
('residual =');
disp (residual');
catch m
throw (m);
end
end
function
cplexlsqnonnegqcpex
% Use the function
cplexlsqnonnegqcp to solve a nonnegative least
squares
% problem. The variables are
binary and one constraint is quadratic.
%
-----------------------------------
------------------------------------
----
% File: cplexlsqnonnegmiqcpex.m
%
Version 12.5
%
-----------------------
----------------------------------------------------
% Licensed Materials - Property of
IBM
% 5725-A06 5725-A29 5724-Y48 5724-Y49
5724-Y54 5724-Y55 5655-Y21
% Copyright IBM
Corporation 2008, 2012. All Rights Reserved.
%
% US Government Users Restricted
Rights - Use, duplication or
%
disclosure restricted by GSA ADP Schedule Contract
with IBM Corp.
%
---------------------
--------------------------------------------------
----
try
C =
[0.0372 0.2869
0.6861
0.7071
0.6233 0.6245
0.6344 0.6170];
d = [0.8587
0.1781
0.0747
0.8405];
Aineq = [0.2027 0.2721
0.1987 0.1988
0.6037 0.0152];
bineq = [0.5251
0.2026
0.6721];
l = [0 0]';
r = 1;
Q = [1 0
0 1];
options = cplexoptimset;
stics
= 'on';
[x, resnorm,
residual, exitflag, output] = ...
cplexlsqnonnegqcp (C, d, Aineq, bineq, [], [], l,
Q, r, [], options);
fprintf ('nSolution status = %sn',
tatusstring);
disp ('Values =');
disp (x');
disp ('resnorm
=');
disp (resnorm);
disp
('residual =');
disp (residual');
catch m
throw (m);
end
end
function cplexlsqqcpex
% Use the function cplexlsqqcp to solve a
constrained least squares problem
% Some
variables are binary and one constraint is
quadratic.
%
---------------
--------------------------------------------------
------
----
% File: cplexlsqqcpex.m
% Version 12.5
%
-----------------
--------------------------------------------------
----
----
% Licensed Materials -
Property of IBM
% 5725-A06 5725-A29
5724-Y48 5724-Y49 5724-Y54 5724-Y55 5655-Y21
% Copyright IBM Corporation 2008, 2012. All
Rights Reserved.
%
% US Government
Users Restricted Rights - Use, duplication or
% disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
%
------------
--------------------------------------------------
---------
----
try
C = [0.9501 0.7620 0.6153 0.4057
0.2311 0.4564 0.7919 0.9354
0.6068 0.0185 0.9218 0.9169
0.4859 0.8214 0.7382 0.4102
0.8912 0.4447 0.1762 0.8936];
d = [0.0578
0.3528
0.8131
0.0098
0.1388];
Aineq = [0.2027 0.2721
0.7467 0.4659
0.1987 0.1988
0.4450 0.4186
0.6037 0.0152
0.9318 0.8462];
bineq = [0.5251
0.2026
0.6721];
lb = -0.1 * ones(4, 1);
ub = 2.0 *
ones(4, 1);
l = [0 0 0
0]';
r = 1;
Q = [1 0 0
0
0 1 0 0
0 0 1
0
0 0 0 1];
options = cplexoptimset;
stics =
'on';
[x, resnorm,
residual, exitflag, output] = ...
cplexlsqqcp (C, d, Aineq, bineq,[ ], [ ], l, Q, r,
...
lb, ub, [ ], options);
fprintf ('nSolution status = %sn',
tatusstring);
disp ('Values =');
disp (x');
disp ('resnorm
=');
disp (resnorm);
disp
('residual =');
disp (residual');
catch m
throw (m);
end
end
function cplexmilpex
% Use the function cplexmilp to solve a
mixed-integer linear programming
problem
%
% The MILP problem solved in this
example is
% Maximize x1 + 2 x2 + 3 x3
+ x4
% Subject to
% - x1 +
x2 + x3 + 10 x4 <= 20
% x1 - 3 x2 +
x3 <= 30
% x2 -
3.5x4 = 0
% Bounds
% 0
<= x1 <= 40
% 0 <= x2
%
0 <= x3
% 2 <= x4 <= 3
%
Integers
% x4
% ------------------------------------------------
-----------------------
----
% File:
cplexmilpex.m
% Version 12.5
%
-------------------------------------------------
----------------------
----
% Licensed
Materials - Property of IBM
% 5725-A06
5725-A29 5724-Y48 5724-Y49 5724-Y54 5724-Y55
5655-Y21
% Copyright IBM Corporation 2008,
2012. All Rights Reserved.
%
% US
Government Users Restricted Rights - Use,
duplication or
% disclosure restricted by
GSA ADP Schedule Contract with IBM Corp.
%
----------------------------------------------
-------------------------
----
try
% Since cplexmilp solves
minimization problems and the problem
%
is a maximization problem, negate the
objective
f = [-1 -2 -3 -1]';
Aineq = [-1 1 1 10;
1 -3 1
0];
bineq = [20 30]';
Aeq = [0 1 0 -3.5];
beq =
0;
lb = [0; 0; 0;
2];
ub = [40; inf; inf; 3];
ctype = 'CCCI';
options =
cplexoptimset;
stics = 'on';
[x, fval, exitflag, output] =
cplexmilp (f, Aineq, bineq, Aeq, beq,...
[ ], [ ], [ ], lb, ub, ctype, [ ], options);
fprintf ('nSolution
status = %s n', tatusstring);
fprintf
('Solution value = %f n', fval);
disp
('Values =');
disp (x');
catch
m
throw (m);
end
end
function cplexmiqpex
% Use the function cplexmiqp to solve a mixed-
integer quadratic programming
problem
%
% The MIQP problem solved in this
example is
% Maximize x1 + 2 x2 + 3 x3
+ x4
% - 0.5 ( 33x1*x1 +
22*x2*x2 + 11*x3*x3 - 12*x1*x2 - 23*x2*x3 )
% Subject to
% - x1 + x2 + x3
+ 10 x4 <= 20
% x1 - 3 x2 + x3
<= 30
% x2 - 3.5x4 =
0
% Bounds
% 0 <= x1 <=
40
% 0 <= x2
% 0 <=
x3
% 2 <= x4 <= 3
%
Integers
% x4
% ------------------------------------------------
-----------------------
----
% File:
cplexmiqpex.m
% Version 12.5
%
-------------------------------------------------
----------------------
----
% Licensed
Materials - Property of IBM
% 5725-A06
5725-A29 5724-Y48 5724-Y49 5724-Y54 5724-Y55
5655-Y21
% Copyright IBM Corporation 2008,
2012. All Rights Reserved.
%
% US
Government Users Restricted Rights - Use,
duplication or
% disclosure restricted by
GSA ADP Schedule Contract with IBM Corp.
%
----------------------------------------------
-------------------------
----
try
% Since cplexmiqp solves
minimization problems and the problem
%
is a maximization problem, negate the
objective
H = [33 6 0 0;
6 22 11.5 0;
0 11.5
11 0;
0 0 0 0];
f = [-1 -2 -3 -1]';
Aineq = [-1 1 1 10;
1 -3 1 0];
bineq = [20 30]';
Aeq = [0 1 0 -3.5];
beq = 0;
lb =
[ 0; 0; 0; 2];
ub = [40; inf;
inf; 3];
ctype = 'CCCI';
options = cplexoptimset;
stics = 'on';
[x, fval,
exitflag, output] = cplexmiqp (H, f, Aineq, bineq,
Aeq, beq,...
[], [], [], lb, ub,
ctype, [], options);
fprintf ('nSolution status = %s n',
tatusstring);
fprintf ('Solution value
= %f n', fval);
disp ('Values =');
disp (x');
catch m
disp(e);
end
end
metropolitan-矢气
嗡可以组什么词-paragraph是什么意思中文翻译
帮助的英文-洋泾浜
single是什么意思-境界是什么意思
淋漓的拼音-黄昏恋
骑自行车英语怎么写-crossover什么意思啊
accompanying-guarantee是什么意思
equalization-关节囊
-
上一篇:商户类别代码
下一篇:245fa和环戊烷发泡解析