the problem about how to modify the maximal iterations

102 views
Skip to first unread message

shuang...@gmail.com

unread,
Oct 7, 2017, 10:54:07 AM10/7/17
to apmonitor
hello apmonitor

         I utilize the amp minlp to solve my essay's problem about how to optimize the omni-channel distribution network. 
        (1) when solving the problem that online demand for 3 types of products in 11 locations is delivered by some of 17 stores, I set up 226 integer variable and one real variable. Please look at the following picture of the result. Computing 500 iterations and get feasible result. (the time of computing is less than 5 minutes)

       (2) In the same model, I increase up to 29 demand locations for 3 types of products, need 642 integer variables and one real variable. However, the result shows "reaching maximum MINLP iterations, the computer hasn't gotten the feasible result" (the time of computing is less than 20 minutes)

    Now my essay's model hasn't logical issues, but iteration limitation causes infeasible results when the number of integer variables increases. I have tried my best to set up the least number of variables. How can I modify the maximal iterations? 
      
Thanks for your answer.

                                                                               sender: Mei shuangruo

                                                                                      

John Hedengren

unread,
Oct 7, 2017, 12:48:49 PM10/7/17
to apmo...@googlegroups.com

Dear Mei shuangruo,

Below is an example model section to add to your APM file that writes an apopt.opt file (APOPT Options File). When APOPT runs, it reads this file to adjust the MINLP algorithm such as Maximum Iterations. There are also other tuning parameters that you can adjust to improve the performance or termination criteria.

Best regards,

John Hedengren
 

 

! apopt solver options (see apopt.com)

File apopt.opt

 minlp_maximum_iterations 500     ! minlp iterations

 minlp_max_iter_with_int_sol 10   ! minlp iterations if integer solution is found

 minlp_as_nlp 0                   ! treat minlp as nlp

 nlp_maximum_iterations 50        ! nlp sub-problem max iterations

 minlp_branch_method 1            ! 1 = depth first, 2 = breadth first

 minlp_gap_tol 0.01               ! covergence tolerance

 minlp_integer_tol 0.05           ! maximum deviation from whole number to be considered an integer

 minlp_integer_leaves 0           ! create soft (1) integer leaves or hard (2) integer leaves with branching 

End File

--
--
APMonitor user's group e-mail list.
- To post a message, send email to apmo...@googlegroups.com
- To unsubscribe, send email to apmonitor+...@googlegroups.com
- Visit this group at http://groups.google.com/group/apmonitor

---
You received this message because you are subscribed to the Google Groups "apmonitor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apmonitor+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

shuang...@gmail.com

unread,
Oct 8, 2017, 2:15:16 AM10/8/17
to apmonitor

Thank you for your help

       I followed your answer above. I created one file (apopt.opt.m) in my apm(folder).

(1)  After adding the apopt.opt.m (file) to my apm (folder), I run my minlp.m in the example minlp. The result showed "reach the maximal iteration" and "infeasible result"      

(2) Then, I add  apopt.opt.m (file) to the example minlp (folder). Please look at the following picture. amp (the second folder) and example_minlp (the fifth folder) are in the same folder ( folder's name is ANALYSIS).  Under this situation, I run the minlp.m in the example minlp (folder) again. The result is still  "reach the maximal iteration" (iteration 10000). However, I have written maximal iteration is 20000 in apopt.opt.m

(3) I created apopt.opt (file)(not ".m" file) instead of apopt.opt.m, after tesing apopt.opt.m. However, maximal iteration is still not converted. 



 (4) I click your response' link and enter the page of "download apopt solver". I can find apopt.py (file)  in "AMPL and Pyomo" version, Python version and Julia version, but I can't find apopt (file) in matlab version. 

Which error is in my procedure and operation? 

                                                              Mei shuangruo

John Hedengren

unread,
Oct 8, 2017, 2:18:42 AM10/8/17
to apmo...@googlegroups.com

Sorry that I wasn’t more clear with my explanation. Please copy the section including “File apopt.opt”…”End File” directly into your apm file. It can be at the top of your APM file. No other modifications are necessary to the files for your application. When the model file is processed, it creates the apopt.opt file on the server where it is needed to adjust the options for the solver. The same strategy can be used for the IPOPT solver with ipopt.opt or the BPOPT solver with bpopt.opt. Those solvers do not have Mixed Integer capabilities, however.

 

Best regards,

John Hedengren

--

shuang...@gmail.com

unread,
Oct 9, 2017, 10:43:06 AM10/9/17
to apmonitor

 add the attachment

minlp.apm

shuang...@gmail.com

unread,
Oct 9, 2017, 10:43:06 AM10/9/17
to apmonitor
I'm sorry. Maybe I'm a bit foolish, so I haven't changed the minlp_maximum_iterations since now. My computer use windows7 and version is 64bit. matlab version is R2016b

(1) I follow your talk and add "file apopt.opt"..."End file" to my apm.m (file) like the picture. And the computer said all of script variables are stopped because of 'end'


(2) I try again. At this time, I write  "file apopt.opt"..."End file" in the function response =amp(server,app,aline) like the following picture. Matlab said "Because File isn't defined, "File apopt.opt" command isn't executed.
     I know your meaning " I should  create a file whose name is apopt and icon is .opt (apopt.opt). When apm.m is executed, amp server can change "minlp_maximum_iteration". I search the order about creating and opening file.I use "edit" order and try again (look at the following picture). However, the error is " "minlp_maximum_iteration" function isn't defined" .



(3) I do other method again. At this time, I never add anything in my apm.m (file) and direclty add apopt.opt in my amp folder. look at the picture. Under this situation, I execute minlp.m and I couldn't convert "minlp_maximum iterations" into 20000.

(4) I search your amp monitor website and find "APM server(windows)". I think the reason that I could't change "minlp_maximum iterations" is that I didn't set up APM server in my computer in advance. Thus, I attemp to set up the amp server. Firstly, I install Apache Web Server and the result like picture. Secondly, I attempt to download php from your link. Maybe I live in Seoul and can't open the website, so I download php 7.1 version and php 7.0.13 from other website. I follow your "php installation" 's video, copy your website's code into the end of  C:\Apache24\httpd.conf (I have stopped my Apache server before doing this process), and change "Copy php.ini-production to php.ini
  • Change line to "max_execution_time = 100000000" .  However, the result is like the picture. "Your httpd.conf cannot be load into server". The error  may be incurred by php7apache2_4.dll. My friend said your "php7apache2_4.dll" version isn't suitable to apm server.

Problem:
(1) Should I install the amp server if I want to change "minlp_maximum_iteration"?  I find the server of the example from "APmonitor download for window" is different from one of amp monitor (look at the picture). The first picture is amp monitor 's.  The second picture is "APmonitor download for window" 's
(2) How can I solve my current error if I have to install amp server?  Where is the error?  (Apache web server? php version? ). If the error is "php7apache2_4.dll", can you offer php 7.0.13 to me.
(3) I add my minlp.apm as the attachment. If I don't install amp server, Could you give me the amp.m (file) that has be added "minlp_maximum_iteration"?

Thank you for your help. I have to solve the part for my essay.



Auto Generated Inline Image 1

John Hedengren

unread,
Oct 9, 2017, 10:46:45 AM10/9/17
to apmo...@googlegroups.com

You should put the solver options in your minlp.apm file as:

 

 

 

 

Best regards,

 

John Hedengren

 

From: apmo...@googlegroups.com [mailto:apmo...@googlegroups.com] On Behalf Of shuang...@gmail.com
Sent: Monday, October 9, 2017 7:46 AM
To: apmonitor <apmo...@googlegroups.com>
Subject: Re: [APM] the problem about how to modify the maximal iterations

 

 add the attachment

minlp.apm
Reply all
Reply to author
Forward
0 new messages