The 1STOPT1STOPT programming model

Source: Internet
Author: User
Tags cos sin
1STOPT Programming Mode



1STOPT Quick mode Intuitive, simple, clear, easy to master, can solve most of the optimization problems, but for some complex problems, such as the objective function or constraint function can not use a simple expression to express the calculation, but through the complex logic judgment, cyclic operation, etc. to represent the calculation, fast mode is powerless, The 1STOPT programming mode can be used to solve this problem. 1STOPT directly supports basic and Pascal two languages. Theoretically speaking, the programming pattern can solve the problem in all shortcut modes.



Main keywords for programming mode:

1) StartProgram: Defines the starting line y "StartProgram [basic]" of the programming mode to represent the use of Pascal in Basic language y "StartProgram [Pascal]" or "StartProgram"

2) Endprogram: The terminating lines that define the programming pattern are written in the standard delphi/pascal or basic language between "StartProgram" and "Endprogram".

3) Objectiveresult: Define the objective function, only once.

4) Constrainedresult: Defines a constraint function and can have multiple.


An example of constrained function optimization

1STOPT Quick Mode Code:

Parameter x (4) =[-100,100]; 

Minfunction 10*x1+9*x2+8*x3+7*x4*sin (x1+x2+x3); 
            (3*x2+2*x4*cos (x1+x2+x3+x4)) ^2<=90; 
                                     x1+x2>=-30; 
                                     x3+x4>=30; 
                                 3*x1+2*x3<=120;

1STOPT Programming mode Basic code:

Parameter x (4) =[-100,100]; 
Minimum; 
StartProgram [Basic]; 
Sub Mainmodel 
objectiveresult = 10*x1+9*x2+8*x3+7*x4*sin (x1+x2+x3)
Constrainedresult = (3*x2+2*x4*cos (x1    +x2+x3+x4)) ^2<=90 
constrainedresult = x1+x2>=-30 
constrainedresult = x3+x4>=30 
Constrainedresult = 3*x1+2*x3<=120 End
Sub 
Endprogram; 


1STOPT Programming Mode Pascal code:

Parameter x (4) =[-100,100]; 
Minimum; 
StartProgram [Pascal]; 
Procedure Mainmodel; 
Begin 
    Objectiveresult: = 10*x1+9*x2+8*x3+7*x4*sin (x1+x2+x3); 
    Constrainedresult: = Sqr (3*x2+2*x4*cos (x1+x2+x3+x4)) <=90; 
    Constrainedresult: = x1+x2>=-30; 
    Constrainedresult: = x3+x4>=30; 
    Constrainedresult: = 3*x1+2*x3<=120; 
End; 
Endprogram;




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.