Benjamin Lindqvist
Benjamin Lindqvist

Reputation: 4620

Returning multiple solutions with CPLEX, 'bad suffix .npool'

I've tried generating multiple solutions with cplex using

option solver cplexamp;
option cplex_options 'poolstub=solfile populate=1 poolintensity=4';

...

for {k in K_mach_RESOURCES} {
    solve SUB1[k];
    for {l in 1..SUB1[k].npool}{
        solution ("solfile" & l & ".sol");
        display _varname, _var;
    }

Gives the error

    Bad suffix .npool for SUB1
context:  for {l in  >>> 1..SUB1[k].npool} <<< {
Possible suffix values for SUB1.suffix:
    astatus   exitcode   message   relax
    result    sstatus    stage  

The weird thing is that it's generating .sol files, but I don't know how to access the generated solutions! Possibly relevant info: there's multiple problems declared in the run file. Accessing Current.npool doesn't work either (in fact, it assumes Current is the latest DECLARED problem, not the latest SOLVED problem). Any ideas??

Upvotes: 1

Views: 382

Answers (2)

foliveira2
foliveira2

Reputation: 41

I think you forgot the "solve" command

ampl: solve;

and then you can display the results.

Upvotes: 0

Benjamin Lindqvist
Benjamin Lindqvist

Reputation: 4620

It seems as if the problem arose because the problem wasn't defined to be an INTEGER problem, but a LP-relaxation of an integer problem.

For some reason, CPLEX doesn't seem to support the populate method for linear programs.

Upvotes: 1

Related Questions