Info

This question is closed. Reopen it to edit or answer.

mexFunction returns different outputs

2 views (last 30 days)
shdotcom shdotcom
shdotcom shdotcom on 21 Sep 2019
Closed: MATLAB Answer Bot on 20 Aug 2021
I have a c source code that consists of several .c files. I have build the mexFunction for it. However, when I run the code, I got different outputs.
The C code returns:
Initialization took 0.0000000000 seconds
best 428, iteration: 1, time 0.00
Best Solution in try 0 is 428
Best Solution was found after 1 iterations
try 0, Best 428, found at iteration 1, found at time 0.000000
best 428, iteration: 1, time 0.00
Best Solution in try 1 is 428
Best Solution was found after 1 iterations
try 1, Best 428, found at iteration 1, found at time 0.000000
best 428, iteration: 1, time 0.00
Best Solution in try 2 is 428
Best Solution was found after 1 iterations
try 2, Best 428, found at iteration 1, found at time 0.000000
best 427, iteration: 1, time 0.00
Best Solution in try 3 is 427
Best Solution was found after 1 iterations
try 3, Best 427, found at iteration 1, found at time 0.000000
best 428, iteration: 1, time 0.00
Best Solution in try 4 is 428
Best Solution was found after 1 iterations
try 4, Best 428, found at iteration 1, found at time 0.000000
best 431, iteration: 1, time 0.02
Best Solution in try 5 is 431
Best Solution was found after 1 iterations
try 5, Best 431, found at iteration 1, found at time 0.016000
best 432, iteration: 1, time 0.00
Best Solution in try 6 is 432
Best Solution was found after 1 iterations
try 6, Best 432, found at iteration 1, found at time 0.000000
best 427, iteration: 1, time 0.00
Best Solution in try 7 is 427
Best Solution was found after 1 iterations
try 7, Best 427, found at iteration 1, found at time 0.000000
best 426, iteration: 1, time 0.00
Best Solution in try 8 is 426
Best Solution was found after 1 iterations
try 8, Best 426, found at iteration 1, found at time 0.000000
best 428, iteration: 1, time 0.00
Best Solution in try 9 is 428
Best Solution was found after 1 iterations
try 9, Best 428, found at iteration 1, found at time 0.000000
t_avgbest = 0.001600
t_avgtotal = 0.001600
while in Matlab, I got this:
MEX completed successfully.
>> callACS('callACS','--tsplibfile', 'eil51.tsp', '--acs', '--rho', '0.1', '--q0', '0.95', '--time', '60.', '--optimum', '42029', '--ants', '10')
Initialization took 0.0010000000 seconds
Please check the attached source code, what i should change to get same results?

Answers (0)

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!