MATLAB AMPL Solver: "No Indices and No Values Retrieved"
28 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to run AMPL solver with MATLAB. It does work, but in the moment of getting the results I have this error I cannot find anywhere on the internet. The code is this.
addpath('C:\Program Files\MATLAB\AMPL\amplapi\matlab');
setUp; ampl = AMPL('C:\Program Files\MATLAB\AMPL\');
ampl.setOption('solver', 'cplex'); ampl.setOption('gentimes', '1'); ampl.setOption('show_stats', '1');
ampl.setOption('cplex_options', 'primal mipdisplay=2 mipgap=1e-1 timing=1 timelimit=1200');
ampl.read('AMPL_Models/model.mod');
ampl.readData('inputData.dat');
ampl.solve;
x_ampl = ampl.getVariable('x');
x = cell2mat(table2cell(x_ampl.getValues.toTable)); % This gives me the error.
The error shown (regarding the last line of the code) is this one.
Error using HandleException (line 13)
No indices and no values retrieved.
Error in Entity/getValues (line 154)
HandleException(e, 'AMPLAPI:Entity:getValues');
Error in Entity/subsref (line 75)
result = builtin('subsref',self,key);
Error in algorithmAMPL (line 28)
x = cell2mat(table2cell(x_ampl.getValues.toTable));
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Performance and Memory en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!