NONZ Command
The NONZ, or NONZEROS, command displays an abbreviated version of the solution for the current model. NONZ is identical to the SOLUTION command with the exception that NONZ displays information only about nonzero variables and binding rows (i.e., the slack or surplus is 0).
The syntax of the NONZ command is:
NONZ ['header_text'] [var_or_row_names]
For a standard NONZ solution report, omit the two optional arguments and enter the NONZ command by itself. LINGO will print primal and dual values for all nonzero variables and binding rows. LINGO will label all the columns in the report.
The first optional field, header_text, will be displayed as a title header in the solution report. If the header_text argument is included, LINGO prints primal values only, omitting all labels in the report.
The second optional field, var_or_row_names, is a variable and/or row name list that, if included, will limit the report to the given variables or rows. The standard wild card characters (* and %) are supported in the variable and row names.
As an example, in the following session, we load the Chess Snackfoods example from the Using Sets section and then generate several solution reports using NONZ:
: TAKE CHESS.LNG
: TERSE
: GO
Global optimal solution found at step: 0
Objective value: 2692.308
: !Generate a standard NONZ report
: NONZ
Variable Value Reduced Cost
SUPPLY( PEANUTS) 750.0000 0.000000
SUPPLY( CASHEWS) 250.0000 0.000000
PRICE( PAWN) 2.000000 0.000000
PRICE( KNIGHT) 3.000000 0.000000
PRICE( BISHOP) 4.000000 0.000000
PRICE( KING) 5.000000 0.000000
PRODUCE( PAWN) 769.2308 0.000000
PRODUCE( KING) 230.7692 0.000000
FORMULA( PEANUTS, PAWN) 15.00000 0.000000
FORMULA( PEANUTS, KNIGHT) 10.00000 0.000000
FORMULA( PEANUTS, BISHOP) 6.000000 0.000000
FORMULA( PEANUTS, KING) 2.000000 0.000000
FORMULA( CASHEWS, PAWN) 1.000000 0.000000
FORMULA( CASHEWS, KNIGHT) 6.000000 0.000000
FORMULA( CASHEWS, BISHOP) 10.00000 0.000000
FORMULA( CASHEWS, KING) 14.00000 0.000000
Row Slack or Surplus Dual Price
1 2692.308 1.000000
2 0.000000 1.769231
3 0.000000 5.461538
: !Generate a NONZ report for PRODUCE
: NONZ PRODUCE
Variable Value Reduced Cost
PRODUCE( PAWN) 769.2308 0.000000
PRODUCE( KING) 230.7692 0.000000
: !Now add a header and use a wildcard in the name
: NONZ 'NONZERO PRODUCTION VALUES:' PROD*
NONZERO PRODUCTION VALUES:
769.2308
230.7692
If you would like to capture the solution report in a file, use the DIVERT command before the NONZ command.
For more information on the interpretation of the various fields in the NONZEROS report, see Getting Started with LINGO.
Note: | If the solution report is scrolling off the screen, you can use the PAGEcommand to set the page length to n lines, so LINGO will pause every time n lines are printed and wait until you are ready to proceed with the next page. |