# Read from file a (Convex.jl) problem

**URL:** https://discourse.julialang.org/t/read-from-file-a-convex-jl-problem/129402
**Category:** Optimization (Mathematical)
**Tags:** jump, convex
**Created:** [May 28, 2025, 9:47am UTC](https://discourse.julialang.org/t/read-from-file-a-convex-jl-problem/129402 "2025-05-28T09:47:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![CaG21](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@CaG21](https://discourse.julialang.org/u/CaG21)
#### Post date: [May 28, 2025, 9:47am UTC](https://discourse.julialang.org/t/read-from-file-a-convex-jl-problem/129402/1 "2025-05-28T09:47:18Z")

</div>

I saved a convex problem, not solved yet, created by using Convex.jl, in a MOF/JSON file, with the `write_to_file` function.  
Now, I want to read that problem and start the opimization using the function `Convex.solve!`. However, there is no `read_from_file` implemented in Convex.jl. I know that I can read it and then solve it using JuMP, but I’d like to exploit warmstart, since I have a good initial solution. And I have not found an easy way to do it in JuMP, even though I am not an expert and could have missed something.  
Is there a way to read the problem from file and exploit the warmstart?

---

<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: [May 28, 2025, 7:55pm UTC](https://discourse.julialang.org/t/read-from-file-a-convex-jl-problem/129402/2 "2025-05-28T19:55:51Z")

</div>

I don’t know how easy it would be to have `read_from_file` in Convex.jl.

Do you have a warmstart for the full model that is in the `.mof.json` file? Or just the original user variables in Convex?

---

<div class="post-metadata">

### Author: ![CaG21](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@CaG21](https://discourse.julialang.org/u/CaG21)
#### Post date: [May 28, 2025, 9:20pm UTC](https://discourse.julialang.org/t/read-from-file-a-convex-jl-problem/129402/3 "2025-05-28T21:20:57Z")

</div>

I checked and, actually, I do not have the warmstart in the `.mof.json` (i.e., there is no `primal_start` field). I do not know if this is an intended behavior of `Convex.write_to_file` or there is a problem somewhere.  
Just to give a little bit of context, my problem is a MISOCP. I construct the model using Convex.jl, then I set the value of the solely integer variables with `set_value!`, and then I use `Mosek` to solve the problem with the attribute `MIO_CONSTRUCT_SOL` so that it can construct a feasible solution from the partial integer solution, reducing so the runtimes.

---

<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: [May 28, 2025, 10:34pm UTC](https://discourse.julialang.org/t/read-from-file-a-convex-jl-problem/129402/4 "2025-05-28T22:34:22Z")

</div>

Why are you saving to a file? Why not just build and solve from Convex.jl?

---

<div class="post-metadata">

### Author: ![CaG21](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@CaG21](https://discourse.julialang.org/u/CaG21)
#### Post date: [May 29, 2025, 6:20am UTC](https://discourse.julialang.org/t/read-from-file-a-convex-jl-problem/129402/5 "2025-05-29T06:20:38Z")

</div>

Actually, I am working with the Mosek support to reproduce a bug (causing the solver to freeze and BSoD the computer), and they’d like to have a model file. Plus, since it is working material, I do not want to provide my full software.
