Analytica 4.3 beta Release Notes/Changes in 4.3.0.22


This page lists changes in build 4.3.0.22 since build 4.3.0.19

Dates and Times

As described in What's new in Analytica 4.3?, date/time numbers are distinguished in Analytica 4.3 from real-value numbers. This allows both to be displayed in the same table using different formats (e.g., date format for dates, Suffix format for numbers). Several adjustments in this build, listed below, are focused on making the number format settings more intuitive.

  • The Number Format Dialog has several refinements.
    • Selecting Date (and adjusting the date settings) does not cause numbers in the view to be displayed as dates. Only date/time values are impacted by those changes.
    • Instead, there is a new checkbox, Display numbers as dates, which is unchecked by default. You have to check this checkbox for real-numbers to be displayed as dates.
    • When you've selected Date (and not checked Display numbers as dates), the format used for numbers is distinguished in an italics font.
    • When you bring up the Number Format dialog, it will open with Date selected if your table contains all dates, or if a selected region starts with a date.
  • When you enter something that can be interpreted (in full) as a date, time, or date and time, it will be parsed as a date/time number. Formerly this behavior only occurred when the number format was set to Date. Thus, if you enter:
2-10-2011
into a definition, it will be parsed as 20-Feb-2011 (or with non-US regional settings, as 2-Oct-2011) rather than as two consecutive subtractions. In contrast, the definition:
(2-10-2011)
which includes parentheses is interpreted as the subtraction expression that evaluates to -2019. If you really want to suppress this "parse as date if possible" functionality, then check Display dates as numbers in the number format dialog.
Note: You might consider setting Display dates as numbers on extremely long edit table that receive OLE-linked data or pasted data from an external source. The algorithm for testing whether the cell can be interpreted as a date does take some time, so if you are linking in million-cell tables, turning this setting off can speed up the parsing slightly.
  • SpreadsheetRange and SpreadsheetCell read in date-valued cells as date-numbers in Analytica, and also adjust the value to match the actual date origin settings being used by both Excel and Analytica. Thus, dates and time read in correctly even if you haven't set the Use Excel Date Origin preference setting, or if you've changed the Excel-side preference to use the standard Analytica 1904 date-origin.
  • SpreadsheetSetRange and SpreadsheetSetCell write date-values to Excel as date cells, again adjusting for the date origins used by both Analytica and Excel to ensure that a consistent date value is transferred.

SpreadsheetSetRange and SpreadsheetSetCell read/write values as date-numbers when they are dates. For example, if Excel

  • Sequence(date1, date2) produces date-numbers even when the «dateUnit» parameter is omitted.

Expressions

  • You can now use multi-stage cascaded inequality expressions where a logical expression is expected. For example:
If 0 < p <= 1 Then ... Else ...
This is equivalent to writing:
If 0 < p And p <= 1 Then ... Else ...
  • The use of parentheses changes the interpretation. For example:
If 0 < (p <= 1) Then ... Else ...
tests that the boolean value, p<=1, is greater than 0. The effect here is to test just that p<=1.
  • This syntax does not create any backward compatibility issues, since a cascaded comparison syntax was rejected in Analytica 4.2.
  • Some changes were made to equality tests between references. Two references, r1 and r2, are now considered equal when their values are identical. They can also be used in this fashion in associative lookup (i.e., Subscript).

Built-in Functions

  • A problem was fixed with SpreadsheetRange when howToIndex:8 is used to automatically read the column headers. The column headers were previously offset by an amount related to the position of range in the original spreadsheet.
  • An optional parameter makes it possible to read the spreadsheet cell formula, rather than just the value, when using SpreadsheetCell and SpreadsheetRange. For example:
SpreadsheetCell(wb,"Sheet1","C",1,what:"Formula")

returns the cell formula in cell Sheet1!C1. The new «what» parameter can be any of these values: "Value", "NumericValue", "Formula" and "RelativeFormula". See SpreadsheetRange on the wiki for more details.

  • When using an offset style Subscript/Slice operation inside Dynamic, i.e., an expression of the form A[Time=Time-k], the warning about extending beyond the beginning of time is now suppressed. This is consistent to earlier 4.3 enhancements involving Subscript/Slice in offset form outside of Dynamic. Also, it correctly utilizes a default value with the syntax: A[Time - k, defVal: 0].

Optimization

  • The processing of structured constraint expressions has been dramatically generalized in build 22. Formerly, constraints has to consist of an equality or inequality expression at the top level of the expression. With the new processing, the inequality can occur inside If-Then-Else expressions, Table cells, User-Defined Functions, after Local Variables are declared, inside Dynamic, etc. The following demonstrate possible definitions of a Constraint object that would not be accepted:
  • Inside sub-expressions:
If I < 5 Then x <= y Else x >= y
  • Inside table cells:
Table(J)(3*x + 4*y >= 2, 7*x + 5*y <= 3, x <= y^2 + Cos(z))
FlowEquality(x1, x2, x3)
where
Function FlowEquality(z : ... ) := Sum(z) = 0
Var a := x/y;
Var b := y/x;
a + b <= a - b
Dynamic(Null, Num_planes <= Opt_num_planes[Time - 1])
  • Statically-conditional constraints are now supported. When a constraint is array-valued with intrinsic indexes, your optimization contains an array of scalar constraints, one scalar constraint for each cell of the array. It may be the case, however, that only a subset of those cells are meaningful. Consider:
If @J >1 Then X >= X[@J = @J - 1]
You can express a conditional constraint as shown here with If-Then and no else clause, or equivalently as:
If @J>1 Then X >= X[@J = @J - 1] Else Null
or with any expression that produces the value of Null for cells that should have no constriant.
  • We say a conditional constraint is static when the if-part does not depend on the decision variables. The support here applies only to this class of conditional constraints.
  • In general, non-static (varying) conditional constraints (where the If-part depends on decision variable) will cause the problem to be treated as an NLP. When conditional constraints are present, the NLP solver requires the structure to remain consistent throughout the solution process. For example, if cell1 in the constraint array begins with an inequality constraint, then it cannot later change to an equality constraint or to Null (a disabled constraint). If such a change occurs, the solve aborts with an error.
  • Note: Non-static (varying conditional constraints) can be encompassed into a linear program by utilizing auxilliary binary decision variables. This topic is covered at Formulations that Preserve Linearity for Optimization.
  • Support for range-constraints. The following is an example of a range constraint:
10 <= 3*x + 4*y <= 20
This constraint is now passed to the Frontline LP, QP or QCP engines as a single constraint. Since the built-in Frontline engines included with Analytica Optimizer have a limit on the maximum number of constraints (e.g., 8000 for LP/Quadratic, 2000 for SOCP Barrier), this fact may help keep your problem under the maximum number of variables.
  • For a constraint to be treated as a range-constraint, far-left and far-right differ by a constant amount.
  • When the constraint is a non-quadratic function of the decision variables, it will generally not be treated as a range constraint. The double comparison will, nevertheless, be captured correctly by passing two constraints to the underlying Frontline engine.
  • Cascaded constraints having more than two consecutive comparisons are fully supported. Internally these will usually result in multiple constraints.
  • The shadow price of a dual, or multi-stage, constraint is the smallest difference between the left- and right-hand side of each comparison that appears. For example, if at the solution the comparison were: 10 <= 18 <= 20, then the shadow price would be 2.
  • The result table for Constraint Nodes now displays using a comparison syntax. The comparison syntax displays the value of both the left-hand and right-hand side of the constraint. So, instead of seeing just 0 and 1 (or False and True), you will see table cells such as: {!}3 >= 1 and 5 <= 7. Cells where the constraint is violated are visually distinguished with preceding {!} characters.
  • When you set the number format to Boolean, then it will display True and False instead of using the constraint syntax.
  • If you use the value of a constraint object in the definition of another node, your expression "sees" values of 0 and 1 (for constraint violated or constraint satisfied).
  • The name of the first parameter to the various optimization functions (e.g., OptSolution) is now «opt». In earlier beta 4.3 builds it was «prog».
  • DefineOptimization no longer automatically selects the SOCP Barrier engine. Formerly it would use this engine as the default for quadratically-constrained optimizations (QCPs). However, we've found that this engine has so many problems, it is better to avoid it until Frontline fixes it. For example, it returns total garbage when both linear and quadratic terms are present. It may work ok when only linear or only quadratic terms are present, but we still think it best to wait until Frontline provides a fixed version. For now, QCPs are solved using the "GRG Nonlinear" engine by default.
Given a scalar vector (on the scalar decision variables for an optimization), OptScalarsToDecision maps the result to the indicated decision variable. For an example, OptSolution(opt,x) is equivalent to OptScalarsToDecision(OptSolution(opt), x).
  • These functions are useful if you utilize an external solver engine (as a separate program) via RunConsoleProcess, providing a way of mapping from the solution returned into the model structure.
  • Due to a bug in the earlier build, DefineOptimization(decisions:all) would report a cyclic dependency in certain cases where the DefineOptimization node has decision nodes as descendants. This was fixed.
  • When a model exceeds the number of variables or constraints allowed by a given Frontline solver engine, a sensible message and OptStatusText saying this is issued. The previous error message for this case was incomprehensible.
  • Several optional parameters to OptRead allow you to select the solver engine to use and the solver control settings. E.g.:
OptRead("portfolio.lp", engine: "Gurobi", parameter: "LPMethod", setting: 2)
  • This build supports Lumina-issued licenses for add-on solver engines: LSGRG, LSSQP, Gurobi, OptQuest, MOSEK, Knitro, XPress (these can be purchased separately).

GUI

  • When you set the domain of a node to Discrete + Text and then create an input node for it, the input node treats all entries as text. So, for example, if you type: 1, the value retrieved will be the text "1" rather than the number 1. Also, if you type the name of an identifier, there isn't any confusion. This was present in the previous build, but this build treats the case where you enter a text value with surrounding quotes in s special way. For example, if you enter 'hello', the quotes are not included (in the earlier build they would have been). You can include the quotes by "escaping" them: hello.
  • The result for constraint nodes now displays in constraint form, rather than as 0s and 1s, unless Number Format is set to Boolean. This lets you see the value of the left-hand side and the right-hand side results together.
  • Single identifiers, and INF or -INF, are now accepted in the Domain bounds view without causing the display to revert to the Expressions view.
  • Items in result tables that can be double clicked on to hyperlink elsewhere appear in blue in Analytica 4.3. This build has fixes to several cases where the coloration was incorrect.
  • The TableCellDefault attribute can now be displayed on an object window and in the attribute pane. To do so, place a checkmark next to TableCellDefault in the Object→Attributes.... dialog.

Example Models

  • A Mixed-Integer formulation of travelling salesman was added. The non-linear formulation is still included in the same model.
Comments


You are not allowed to post comments.