summaryrefslogtreecommitdiff
path: root/tests/general_tests/cbcintlinprog/cbcintlinprog_ub2.sce
blob: 60a7df4a55fe62a38c5bed9628871dddae252608 (plain)
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
// Check if a user specifies coefficients of linear inequality contraints of the correct dimensions 

// Reference : Example 2 -1, Travelling salesman , Hamdy A. Taha. "Operations Research-An Introduction", 9E(2014))

// Objective function
c = [1000,10,17,15,20,1000,19,18,50,44,1000,22,45,40,20,1000]';

// Lower Bound of variable
lb = repmat(1,1,16) ;
// Upper Bound of variables
ub = "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]";

// Constraint Matrix
Aeq=[1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0;
     0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0;
     0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0;
     0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1;
     1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0;
     0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0;
     0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0;
     0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1;]

beq=repmat(1,1,8)

intcon = 1:1:16 ;

// Calling cbcintlinprog
[x,f,status,output] = cbcintlinprog(c,intcon,[],[],Aeq,beq,lb,ub)
// !--error 10000 
//cbcintlinprog: Expected type ["constant"] for input argument ub at input #8, but got "string" instead.
//at line      56 of function Checktype called by :  
//at line      70 of function cbcmatrixintlinprog called by :  
//at line     203 of function cbcintlinprog called by :  
//[x,f,status,output] = cbcintlinprog(c,intcon,[],[],Aeq,beq,lb,ub)
//at line      28 of exec file called by :    
//exec cbcintlinprog_ub2.sce