# How to retrieve more results from NEOS Server?

**URL:** <https://discourse.julialang.org/t/how-to-retrieve-more-results-from-neos-server/64222>\
**Category:** Optimization (Mathematical)\
**Created:** [July 7, 2021, 4:17pm UTC](https://discourse.julialang.org/t/how-to-retrieve-more-results-from-neos-server/64222 "2021-07-07T16:17:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fredih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredih/32/20945_2.png) [@fredih](https://discourse.julialang.org/u/fredih)\
**Post date:** [July 7, 2021, 4:17pm UTC](https://discourse.julialang.org/t/how-to-retrieve-more-results-from-neos-server/64222/1 "2021-07-07T16:17:59Z")

</div>

Hello! How can I retrieve the variable values from the NEOS server? Currently I only receive the objective function value in my e-mail.

For example, to this code:

```julia
using JuMP, NamedArrays, Cbc, NEOSServer

threath = Model() do
    NEOSServer.Optimizer(email="my@email.com", solver="CPLEX")
end
regions = [:A, :B, :C, :D, :E]
animals = [:α, :β]
targets = NamedArray([64, 87], animals)
costs = NamedArray([97, 73, 22, 11, 25], regions)
areas = NamedArray([24 83
                    36 16
                    00 19
                    15 00
                    40 18], (regions, animals))
@variable(threath, x[r in regions], Bin)

for animal in animals
    @constraint(threath, sum(x[r]*areas[r,animal] for r in regions) >= targets[animal])
end

@objective(threath, Min, sum(x[r]*costs[r] for r in regions))
optimize!(threath)

```

I only receive this:

> CPLEX 20.1.0.0: optimal integer solution; objective 122  
> 0 MIP simplex iterations  
> 0 branch-and-bound nodes  
> No basis.
> 
> Options  
> 3  
> 1  
> 1  
> 0  
> 2  
> 0  
> 5  
> 5  
> 1  
> 0  
> 0  
> 0  
> 1  
> objno 0 2

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 7, 2021, 7:09pm UTC](https://discourse.julialang.org/t/how-to-retrieve-more-results-from-neos-server/64222/2 "2021-07-07T19:09:13Z")

</div>

The results are automatically loaded back into julia like any other solver. You don’t need to check the email.

(The primal solution is hidden in that file, it’s just not obvious)

---

<div class="post-metadata">

**Author:** ![fredih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredih/32/20945_2.png) [@fredih](https://discourse.julialang.org/u/fredih)\
**Post date:** [July 7, 2021, 8:28pm UTC](https://discourse.julialang.org/t/how-to-retrieve-more-results-from-neos-server/64222/3 "2021-07-07T20:28:51Z")

</div>

Awesome! I didn’t realize, because when I type `solution_summary(threath)` it gives me an error:

`ERROR: ArgumentError: ModelLike of type AmplNLWriter.Optimizer does not support accessing the attribute MathOptInterface.SolveTime()`

But, indeed, if I write in the REPL `value(x[:A])`, it gives back the value. Great!

Nevertheless, I would like to know: why can’t I get the solution summary? Is there a workaround to do so?

Thanks!

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 7, 2021, 9:55pm UTC](https://discourse.julialang.org/t/how-to-retrieve-more-results-from-neos-server/64222/4 "2021-07-07T21:55:13Z")

</div>

This is an oversight in the JuMP code:

> <https://github.com/jump-dev/JuMP.jl/blob/7ef4be423397c82a59e210bb9c0fb67671951ce1/src/print.jl#L478>

But it’s also a problem with AmplNLWriter. I should implement the SolveTime attribute.

As a work-around, you could add this to your script after you have `using JuMP`:

```nohighlight
using JuMP, NEOSServer

# Fake `SolveTime` for AmplNLWriter as a work-around so JuMP doesn't crash on 
# `solution_summary(model)`.
#
# WARNING: This is type-piracy! It should be removed as soon as possible.
using AmplNLWriter
MOI.get(model::AmplNLWriter.Optimizer, ::MOI.SolveTime) = NaN

```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 7, 2021, 10:40pm UTC](https://discourse.julialang.org/t/how-to-retrieve-more-results-from-neos-server/64222/5 "2021-07-07T22:40:59Z")

</div>

I’ve opened a PR: [Implement MOI.SolveTime by odow · Pull Request #144 · jump-dev/AmplNLWriter.jl · GitHub](https://github.com/jump-dev/AmplNLWriter.jl/pull/144), so I will try to get this merged and a new released tagged today.

Edit: merged. Update your packages, restart Julia, and try again.

---

<div class="post-metadata">

**Author:** ![fredih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredih/32/20945_2.png) [@fredih](https://discourse.julialang.org/u/fredih)\
**Post date:** [July 9, 2021, 4:32pm UTC](https://discourse.julialang.org/t/how-to-retrieve-more-results-from-neos-server/64222/6 "2021-07-09T16:32:46Z")

</div>

Wow, awesome! Thanks! I’ll try it today.

And thanks for maintaining the package, by the way, it’s greatto be able to use NEOS with Julia!
