# Make changes of the new model effecting the old one

**URL:** https://discourse.julialang.org/t/make-changes-of-the-new-model-effecting-the-old-one/21092
**Category:** Optimization (Mathematical)
**Created:** [February 22, 2019, 7:15pm UTC](https://discourse.julialang.org/t/make-changes-of-the-new-model-effecting-the-old-one/21092 "2019-02-22T19:15:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![haokuny](https://avatars.discourse-cdn.com/v4/letter/h/4da419/32.png) [@haokuny](https://discourse.julialang.org/u/haokuny)
#### Post date: [February 22, 2019, 7:15pm UTC](https://discourse.julialang.org/t/make-changes-of-the-new-model-effecting-the-old-one/21092/1 "2019-02-22T19:15:59Z")

</div>

Let’s say I have built a model called `mymodel` and I want to make some extension, meaning to add some new variables and constraints, but I want to do it to my new model. So I `mymodelnew = mymodel`.

Then the problem is, whenever I add some variables or constriants to `mymodelnew`, `mymodel` is always updated with these same variables or constraints as well. I want to compare solutions from `mymodel` and `mymodelnew`. Can anyone help me?

Of course I can `optimize!(mymodel)` and then update it and solve again. I just wonder if I can have both old model and the new one.

---

<div class="post-metadata">

### Author: ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)
#### Post date: [February 23, 2019, 4:07am UTC](https://discourse.julialang.org/t/make-changes-of-the-new-model-effecting-the-old-one/21092/2 "2019-02-23T04:07:25Z")

</div>

Maybe `mymodel = copy(model) `  
(untested).

---

<div class="post-metadata">

### Author: ![haokuny](https://avatars.discourse-cdn.com/v4/letter/h/4da419/32.png) [@haokuny](https://discourse.julialang.org/u/haokuny)
#### Post date: [February 23, 2019, 6:17am UTC](https://discourse.julialang.org/t/make-changes-of-the-new-model-effecting-the-old-one/21092/3 "2019-02-23T06:17:09Z")

</div>

Great! That solved my problem. Thanks so much.
