Cbc
Cbc copied to clipboard
any more c interface test example
i hava see the example file CInterfaceTest.c
but the example was too easy model..
i have confused by the param which called start[]
/* Simple knapsack problem
Maximize 5x[1] + 3x[2] + 2x[3] + 7x[4] + 4x[5]
s.t. 2x[1] + 8x[2] + 4x[3] + 2x[4] + 5x[5] <= 10
All x binary
*/
CoinBigIndex start[] = {0, 1, 2, 3, 4, 5, 6};
int rowindex[] = {0, 0, 0, 0, 0};
double value[] = {2, 8, 4, 2, 5};
double collb[] = {0,0,0,0,0};
double colub[] = {1,1,1,1,1};
double obj[] = {5, 3, 2, 7, 4};
double feasible[] = {1,1,0,0,0};
double rowlb[] = {-INFINITY};
double rowub[] = {10};
const double *sol;
const char* setname = "test model";
i have try to build a more constraint model like that
min x1 + 2x2 + 4x3
1 <= x1 + 3x2
-x1 + 2x2 -0.5x3 <= 3
x1 - x2 +2x3 = 3.5
0<x1<1 , x2 <= 10 , 2<=x3
x1,x2 int
and build var like this:
collb:[0.0, -1.7976931348623157E308, 2.0]
colub:[1.0, 10.0, 1.7976931348623157E308]
rowlb:[1.0, -1.7976931348623157E308, 3.5]
rowUb:[1.7976931348623157E308, 3.0, 3.5]
start:[0, 2, 5, 8]
value[1.0, 3.0, -1.0, 2.0, -0.5, 1.0, -1.0, 2.0]
index:[0, 2, 0, 1, 2, 0, 1, 2]
obj:[1.0, 2.0, 4.0]
but the result was worng by [0.0, 0.9999999999999994, 2.0]
any help for explain the start[]
right usage?? it's better if good example : )
If the first constraint has 3 variables and the second one has 2 variables, the vector starts should be
[0,3,5]
On 9/2/19 2:23 PM, Alardear wrote:
i hava see the example file |CInterfaceTest.c| but the example was too easy model.. i have confused by the param which called |start[]|
|/* Simple knapsack problem Maximize 5x[1] + 3x[2] + 2x[3] + 7x[4] + 4x[5] s.t. 2x[1] + 8x[2] + 4x[3] + 2x[4] + 5x[5] <= 10 All x binary */ CoinBigIndex start[] = {0, 1, 2, 3, 4, 5, 6}; int rowindex[] = {0, 0, 0, 0, 0}; double value[] = {2, 8, 4, 2, 5}; double collb[] = {0,0,0,0,0}; double colub[] = {1,1,1,1,1}; double obj[] = {5, 3, 2, 7, 4}; double feasible[] = {1,1,0,0,0}; double rowlb[] = {-INFINITY}; double rowub[] = {10}; const double sol; const char setname = "test model"; |
i have try to build a more constraint model like that
|min x1 + 2x2 + 4x3 1 <= x1 + 3x2 -x1 + 2x2 -0.5x3 <= 3 x1 - x2 +2x3 = 3.5 0<x1<1 , x2 <= 10 , 2<=x3 x1,x2 int |
and build var like this:
|collb:[0.0, -1.7976931348623157E308, 2.0] colub:[1.0, 10.0, 1.7976931348623157E308] rowlb:[1.0, -1.7976931348623157E308, 3.5] rowUb:[1.7976931348623157E308, 3.0, 3.5] start:[0, 2, 5, 8] index:[0, 2, 0, 1, 2, 0, 1, 2] obj:[1.0, 2.0, 4.0] |
but the result was worng by |[0.0, 0.9999999999999994, 2.0]|
any help for explain the |start[]| right usage?? it's better if good example : )
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/coin-or/Cbc/issues/254?email_source=notifications&email_token=AB4VZOR4G637IN77QF5XXJDQHUAV7A5CNFSM4IS453I2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HIYZMCQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AB4VZOQGVA75MNPRW33LB3TQHUAV7ANCNFSM4IS453IQ.
--
Haroldo Gambini Santos Computing Department Universidade Federal de Ouro Preto - UFOP email: [email protected] home/research page: www.decom.ufop.br/haroldo
It has long been an axiom of mine that the little things are infinitely the most important. -- Sir Arthur Conan Doyle, "A Case of Identity"
If the first constraint has 3 variables and the second one has 2 variables, the vector starts should be [0,3,5] On 9/2/19 2:23 PM, Alardear wrote: i hava see the example file |CInterfaceTest.c| but the example was too easy model.. i have confused by the param which called |start[]| |/* Simple knapsack problem Maximize 5x[1] + 3x[2] + 2x[3] + 7x[4] + 4x[5] s.t. 2x[1] + 8x[2] + 4x[3] + 2x[4] + 5x[5] <= 10 All x binary */ CoinBigIndex start[] = {0, 1, 2, 3, 4, 5, 6}; int rowindex[] = {0, 0, 0, 0, 0}; double value[] = {2, 8, 4, 2, 5}; double collb[] = {0,0,0,0,0}; double colub[] = {1,1,1,1,1}; double obj[] = {5, 3, 2, 7, 4}; double feasible[] = {1,1,0,0,0}; double rowlb[] = {-INFINITY}; double rowub[] = {10}; const double sol; const char setname = "test model"; | i have try to build a more constraint model like that |min x1 + 2x2 + 4x3 1 <= x1 + 3x2 -x1 + 2x2 -0.5x3 <= 3 x1 - x2 +2x3 = 3.5 0<x1<1 , x2 <= 10 , 2<=x3 x1,x2 int | and build var like this: |collb:[0.0, -1.7976931348623157E308, 2.0] colub:[1.0, 10.0, 1.7976931348623157E308] rowlb:[1.0, -1.7976931348623157E308, 3.5] rowUb:[1.7976931348623157E308, 3.0, 3.5] start:[0, 2, 5, 8] index:[0, 2, 0, 1, 2, 0, 1, 2] obj:[1.0, 2.0, 4.0] | but the result was worng by |[0.0, 0.9999999999999994, 2.0]| any help for explain the |start[]| right usage?? it's better if good example : ) — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#254?email_source=notifications&email_token=AB4VZOR4G637IN77QF5XXJDQHUAV7A5CNFSM4IS453I2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HIYZMCQ>, or mute the thread https://github.com/notifications/unsubscribe-auth/AB4VZOQGVA75MNPRW33LB3TQHUAV7ANCNFSM4IS453IQ. -- ============================================================= Haroldo Gambini Santos Computing Department Universidade Federal de Ouro Preto - UFOP email: [email protected] home/research page: www.decom.ufop.br/haroldo It has long been an axiom of mine that the little things are infinitely the most important. -- Sir Arthur Conan Doyle, "A Case of Identity"
yep, i just build like you said.. but in my case..i got the wrong solution.. it not satisfy the third constraint.. i have print all the param...