Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrepancy in max/min function usage between Section 4.1.1 and Section 4.3 in Zimpl User's Guide #2

Open
GitHubonline1396529 opened this issue Dec 7, 2024 · 1 comment

Comments

@GitHubonline1396529
Copy link

Description

While working with ZIMPL, I encountered a potential discrepancy in the documentation regarding the usage of the max and min functions. Specifically, the usage demonstrated in Section 4.1.1 (Numeric expressions), Table 2 appears to differ from the syntax used in Section 4.3 (Parameters).

Steps to Reproduce

According to the usage of max in Section 4.1.1 (Numeric expressions), Table 2, it is suggested that we can use max(s in S) e(s) to compute the maximum value of the function e over a set S. To verify this, I tested the following example:

# test.zpl

set I := { 1..3 };

var x;
param num := max(i in I) i^2;

minimize f: x;
subto c: x == num;

When running this model in SCIP, I received the following error:

SCIP> read test.zpl
*** Error 800: File test.zpl Line 5 : syntax error

After modifying the param statement to the syntax shown in Section 4.3, the issue was resolved:

param num := max <i> in I : i^2;

Questions

Does this discrepancy indicate an error in my model when using the syntax demonstrated in Section 4.1.1? Should the syntax max(i in I) i^2 work in certain contexts but I am simply using it incorrectly, or is it only illustrative and not intended to be a valid ZIMPL statement?

Environment

  • SCIP version: 9.2.0
  • ZIMPL version: 3.6.2
  • Operating System: Windows 10 22H2

Thank you for your time and assistance! I look forward to hearing your insights.

@bzfkocht
Copy link
Contributor

bzfkocht commented Jan 1, 2025

This is a mistake in the documentation. Correct is max in I : i^2 .
Note it is possible to add a with statement: max in I with i < 7: i^2
Will be fixed in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants