“This is the 23rd day of my participation in the November Gwen Challenge. See details of the event: The Last Gwen Challenge 2021”.

Lingo operator,

Arithmetic operations

symbol explain
^ chengfang
* take
/ In addition to
+ add
Reduction of

Logical operator

symbol explain
#not# Negate the logical value of the operand. # not# is a unary operator
#eq# True if two operands are equal; It is flase
#ne# True if the two operators are not equal; It is flase
#gt# True if the left-hand operator is strictly greater than the right-hand operator; It is flase
#ge# True if the left operator is greater than or equal to the right operator; It is flase
#lt# True if the operator on the left is strictly less than the operator on the right; It is flase
#le# True if the left operator is less than or equal to the right operator; It is flase
#and The result is true only if both arguments are true; It is flase
#or# The result is false only if both arguments are false; It is true

The precedence of these operators is from highest to lowest:

#not#>#eq#  #ne#  #gt#  #ge#  #lt#  #le#>#and#  #or#

Mathematical function

function explain
@abs(x) Return the absolute value of x
@sin(x) Returns the sine of x in radians
@cos(x) Returns the cosine of x
@tan(x) Returns the tangent of x
@exp(x) Return the constant e to the x
@log(x) Returns the natural log of x
@lgm(x) Returns the natural logarithm of the gamma function of x
@sign(x) Returns -1 if x<0; Otherwise, return 1
@floor(x) Returns the integer part of x. Returns the largest integer that does not exceed x when x>=0; Returns the largest integer not less than x when x<0.
@ smax (x1, x2,… ,xn) Return x1, x2… , the maximum value in xn
@ smin (x1, x2,… ,xn) Return x1, x2… , the minimum value in xn

Variable defining function

function explain
@bin(x) Limit x to 0 or 1
@bnd(L,x,U) Limit L x or less or less U
@free(x) Remove the constraint that the default lower bound of the variable x is 0, that is, x can take any real number
@gin(x) Limit x to an integer

By default, LINGO states that variables are non-negative, that is, bound to 0 below and +∞ above.

@free removes the default lower bound of 0 and allows variables to take negative values.

@bnd is used to set the upper and lower bounds of a variable. It can also remove the constraint that the default lower bound is 0.

Circulation function

@for

This function is used to generate constraints on set members. Modeling language-based scalars require explicit input

Each constraint, though the @for function allows you to enter only one constraint, which LINGO then generates automatically

Constraints on each set member.

@sum

This function returns the sum of an expression that traverses the specified set members.

@ min and @ Max

Returns the minimum or maximum value of an expression for the specified set member.

Input output function

slightly

Auxiliary function

slightly

The financial function

slightly

Conventional linear programming

Example: production plans for processed dairy products

1 pail of milk has two production methods :(A)12 hours /3 kg, profit 24 yuan/kg; (B)8 hours /4 kg, profit 16 yuan/kg.

Requirements: 50 barrels of milk, 480 hours, up to 100 kg A.

Make production plan to maximize profit per day.

The LINGO code is as follows

max=72*a+64*b; ! Profit function; a+b<50; ! Bucket quantity constraint; 12*a+8*b<480; ! Time constraint; 3*a<100; ! A quantitative constraint; ! Nonnegative constraint; a>0; b>0;Copy the code

Notes on the results:

The steps of range analysis of the results

  1. CTRL +I in Lingo opens Option
  2. Click on the General Solveer TAB and set the Dual Computat property to Princes&Ranges
  3. CTRL + R for range analysis

As shown in figure set

Interpretation of the results of range analysis