RE: Help with problem "Custom model error: string > 1500 characters"

46 views
Skip to first unread message

John Hedengren

unread,
May 6, 2013, 1:05:45 PM5/6/13
to calet...@gmail.com, apmo...@googlegroups.com

Lenka,

 

I’m not getting the same error that you received. What text editor are you using? Please consider using one of the text editors listed here:

 

http://apmonitor.com/wiki/index.php/Main/SyntaxHighlighting

 

Both gEdit and Notepad++ have syntax highlighting. I changed your model slightly to add some values for t[48:347]. You may want to check that this is correct. The first error that I received was that t[49] was not defined.  

 

! t[48] = x[48]^2

! t[49:53] = 0

t[48:347] = x[48:347]^2

You should be able to copy this model into the web-interface:

 

http://apmonitor.com/online/view_pass.php

 

and click the green arrow and it solves with a successful solution result. I you want to tap into a community of users, please consider joining the APMonitor Google Groups discussion forum.

 

Best regards,

 

John Hedengren

 

 

---------- Forwarded message ----------
From: Lenka Caletková <calet...@gmail.com>
Date: Sun, May 5, 2013 at 7:30 AM
Subject: Help with problem "Custom model error: string > 1500 characters"
To: sup...@apmonitor.com

Hello,

I am a student of electro-technical faculty at CTU in Prague( Czech Republic) and i am working with your optimization software. I am trying to solve one optimization problem and i alway get this error: "Custom model error: string > 1500  characters
 Consider breaking up the line into multiple equations"

May I ask, where is the problem? Because I controlled all the possibilities, that there is more than 1500 characters in one line and i didn't find it. Please can you help me, where could be the problem? It is really important for me, because I want to use this software for my bachelor thesis. I add the apm file to this email. Thank for reading this and I am looking forward for the answer.

Best regards,

Lenka Caletkova




--

John Hedengren

APMonitor Modeling Language

 

quad24.apm

John Hedengren

unread,
May 7, 2013, 1:41:48 PM5/7/13
to Lenka Caletková, apmo...@googlegroups.com

Lenka,

 

You model file was ending each of the lines with a “CR” character. Are you using a MacOS up to OS 9.0? The more recent MacOS computers use LF like Linux. Here is some additional help on CR and LF:

 

http://en.wikipedia.org/wiki/Newline

 

APM normally requires LF to detect new lines. I’ve attached a version that is in Windows format with CR and LF at the end of each line. You can see newline characters in Notepad++ by Selecting “View”…”Show Symbol”…”Show End of Line”.

 

 

You’ll want to look for the LF indication at the end of each line.

 

 

I’ve attached a copy of your files that should work now.

 

-John Hedengren

 

From: Lenka Caletková [mailto:calet...@gmail.com]
Sent: Tuesday, May 07, 2013 2:52 AM
To: John Hedengren
Subject: Re: Help with problem "Custom model error: string > 1500 characters"

 

Dear John,

first I want to say big thanks to you, that you answered me, because I was really desperate. I did all, what you have told me and in the http://apmonitor.com/online/view_pass.php it works everything properly. But I am writing a program in python language and there i get the problem more than 1500 character per string. So I just want to ask, if this structure is okay:

#server
s = 'http://xps.apmonitor.com'

# application + random number
a = 'zk' + str(randint(2,999))

#clear server
apm(s,a,'clear all')

#load model
apm_load(s,a,'quad24.apm')

#change solver
apm_option(s,a,'quad24.solver',3)

#solve
output = apm(s,a,'solve')
print output

#retrieve solution
(csv, solution) = apm_sol(s,a)
print csv

Thanks a lot for your answer and wish you a beautiful day!

Best regards,

Lenka C.


#open root file
apm_web_root(s,a)
#open solution in web browser
apm_web_var(s,a)

 

2013/5/6 John Hedengren <john_he...@byu.edu>

quad24.zip
Reply all
Reply to author
Forward
0 new messages