I use Solver of AmplNLWriter with some errors

The following is my code :

using JuMP, AmplNLWriter
 m = Model(() -> AmplNLWriter.Optimizer("Your_Path\\lindoapi\\bin\\win64\\runlindo.exe"))

@variable(m, -2 <= x1 <= 2,Int)
@variable(m, -2 <= x2 <= 2)


@constraint(m, -2*x1 - x2 <= 2)
@constraint(m, -x1 - 2*x2 <= 2)
@constraint(m, x1^2 + x2^2 <= 1)

@objective(m, Min, (x1+x2)/(2+x1^2+x2^2))
write_to_file(m,"type4CONF.nl")

println(m)
 
optimize!(m)

value(x1)
value(x2)

objective_value(m)

solution_summary(m)

Firstly, lindoapi can solve this model, but it can not output the solutions. Some errors:

julia> value(x1)
ERROR: Result index of attribute MathOptInterface.VariablePrimal(1) out of bounds. There are currently 0 solution(s) in the model.

and

julia> solution_summary(m)
* Solver : AmplNLWriter

* Status
  Result count       : 0
  Termination status : OTHER_ERROR
  Message from the solver:
  "Error calling the solver. Failed with: SystemError("opening file \"D:\\\\Temp\\\\jl_ugJoB7\\\\model.sol\"", 2, nothing)"

* Candidate solution (result #1)
  Primal status      : NO_SOLUTION
  Dual status        : NO_SOLUTION

* Work counters
  Solve time (sec)   : 4.54000e-01

But, if i revised it with

m = Model(() -> AmplNLWriter.Optimizer("Your_Path\\lindoapi\\bin\\win64\\runlindo.exe",["-sol"]))

Every things is OK.

So, what is wrong with this errors? Thanks very much.

Sincerely,
J. Wang.

We pass -AMPL to executables, but it seems like LINDO requires the non-standard additional argument of -sol.

Your revision seems correct.

Just following up on this, I took a look: Add -sol as a command line argument to solvers by odow · Pull Request #188 · jump-dev/AmplNLWriter.jl · GitHub

Lindo’s requirement to add -sol is non-standard, so you’ll need to do this yourself like you have done. We won’t be adding it by default to AmplNLWriter.

OK, i known.

THanks