Change a few constraints in an existing optimization problem

79 views
Skip to first unread message

Yao Chang

unread,
Sep 4, 2014, 9:06:59 AM9/4/14
to yal...@googlegroups.com
Hi everyone:
    I have a big optimization problem, and I have to change some of its constraints.
    Do I have to re-build the model again (not efficient to do so) or there is a way to changed them directly. 
    for example, I had a constraint 
    x1  + x2  = 3,
    now it is obselete and should be replaced by
    x1 +  x2  = 5

    Thanks guys

Johan Löfberg

unread,
Sep 4, 2014, 3:32:09 PM9/4/14
to yal...@googlegroups.com
Why not

solvesdp([TheRest, x1+x2 == 3],objective)

bla bla

solvesdp([TheRest, x1+x2 == 5],objective)

or you use the optimizer precompiler
http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Blog.Beta-version-of-a-more-general-optimizer
http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Commands.optimizer

Yao Chang

unread,
Sep 4, 2014, 10:16:54 PM9/4/14
to yal...@googlegroups.com
Thanks but the constraint is different from time to time. I guess I need further programming to mark them.

Joachim Dahl

unread,
Sep 5, 2014, 2:19:14 AM9/5/14
to yal...@googlegroups.com
One issue is that it's probably difficult in yalmip to change the model without redoing most of the work;  another issue is that very few solvers will support such reoptimization unless it's a linear model.   What kind of model do you have, and is it possible to provide reproducible code for others to experiment with?

Johan Löfberg

unread,
Sep 5, 2014, 2:46:53 AM9/5/14
to yal...@googlegroups.com
Maybe I misunderstood something. I though you had a scenario where a large part of the model stays the same, and then you solve many problems with some parts changing, and you want to eliminate unnecessary YALMIP overhead from redefining the whole model. Why doesn't this work then?

TheRest = [setup the constant part]

for i = 1:100000
 calculatesomethingsthat change
 
TheChangingConstraint = definethechangingconstraints
 solvesdp
([TheRest,TheChangingConstraint],objective)
  analyzesolution
end

Tis will avoid a large part of the overhead.

But as I said, the fastest way to deal with many similar models is to use the optimizer framework (as it eliminates YALMIP overhead almost completely)

Reply all
Reply to author
Forward
0 new messages