1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
//Reference: K. Deep et al.,"A real coded genetic algorithm for solving integer and mixed integer optimization problems", Applied Mathematics and Computation, 212, p 505-518,2009
//=====================================================================
// Copyright (C) 2018 - IIT Bombay - FOSSEE
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
// Author: Remya Kommadath
// Organization: FOSSEE, IIT Bombay
// Email: toolbox@scilab.in
//=====================================================================
clc;
// Number of decision variables
nVar = 5;
// Num\ber of constraints
nCon = 6;
//integer constraints
intcon = 1:5;
//coefficients of the linear term
f = zeros(1,nVar);
// Hessian matrix
H = [2 0 0 0 0;
0 2 0 0 0
0 0 2 0 0
0 0 0 2 0
0 0 0 0 2];
// Bounds of the problem
lb = zeros(1,nVar);
ub = 3*ones(1,nVar);
// Constraint matrix
A = [-1 -2 0 -1 0;
0 -1 -2 0 0;
-1 0 0 0 -2;
1 2 2 0 0;
2 0 1 0 0;
1 0 0 0 4];
b = [-4 -3 -5 6 4 13]';
// Initial guess to the solver
x0 = lb;
// Calling the solver
[xopt,fopt,exitflag,output] = intqpipopt(H,f,intcon,A,b,[],[],lb,ub,x0)
// Result representation
disp(x0, "The initial guess given to the solver")
select exitflag
case 0
disp("Optimal Solution Found")
disp(xopt',"The optimal solution determined by the solver")
disp(fopt,"The optimal objective function")
case 1
disp("InFeasible Solution")
case 2
disp("Objective Function is Continuous Unbounded")
case 3
disp("Limit Exceeded")
case 4
disp("User Interrupt")
case 5
disp("MINLP Error")
end
|