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

Add support for using preferred number series with the ASCO optimizer + variables search string fix #412

Closed
wants to merge 3 commits into from

Conversation

in3otd
Copy link
Contributor

@in3otd in3otd commented Jan 21, 2016

The ASCO optimizer used by Qucs supports constraining optimization variables to assume discrete values in the IEC 60063 preferred number series but this option was not available in the optimization dialog (I guess the dialog was written before ASCO added support for this), so here is a simple modification to allow this selection.

I have also added an example using this feature of the optimizer. Note that for some reason the ASCO installed on my Linux system with Qucs 0.0.18 throws an error with this schematic, saying that the variable(s) is outside the allowed range. Recompiling ASCO from the sources, it works as expected. I guess this is due to some numerical precision issue, but did not have time to investigate further.

While trying to add the new .sch example file, I noticed that all the .sch files were ignored by Git, apparently due to a rule added to .gitignore some time ago.
I have modified the rule to not ignore the .sch in examples/ and tried to clean up .gitignore a bit, but I realized we should probably think a bit more on how to handle this in general, as we have sometimes also gitignore files in subdirectories repeating the same rules...

@in3otd in3otd changed the title Add support for using preferred number series with the ASCO optimizer Add support for using preferred number series with the ASCO optimizer + variables search string fix Jan 22, 2016
@in3otd
Copy link
Contributor Author

in3otd commented Jan 22, 2016

I have added another commit, still related to ASCO, but not to the previous two. Since it's a quick fix requiring just one change I thought creating a new PR just for this was too much 😁

Some time ago a user reported strange results from a simulation involving the ASCO optimizer, in that the optimization ended immediately and with a big "cost function" value for no apparent reason.
(You can see this problem in this schematic)

It turns out that this is due to the way ASCO works for extracting the Goals variables values from the text dataset. In short, for every variable Qucs prepares a files for ASCO describing how to extract the variable value from the dataset and in particular it tells ASCO to look for the string "<indep VariableName". The problem is that ASCO matches this also for lines like

<indep VariableName1 ...
<indep VariableName2 ...
<indep VariableNameEtc ...

so if there are other variables starting with the same name as a Goal variable, ASCO becomes completely confused and does not perform the optimization properly.

The fix is simple, just pass the correct search string to ASCO, which needs to have a space after the variable name, like "<indep VariableName "

...so the fix is just really adding one space to the code, took much more time to actually describe the problem 😁

@in3otd
Copy link
Contributor Author

in3otd commented Jan 26, 2016

rebased to get a working AppVeyor setup

The ASCO optimizer supports having optimization variables which
can assume only discrete values in the IEC 60063 preferred number
series (E3, E6, E12, E24, E48, E96 and E192).
These preferred number series can now be specified in the
optimization dialog in the Variable Type selection.

Added an example schematic using an optimization with variables
in the E12 and E24 series.
.sch files were explicitly ignored, so that new files added to
examples/ were not seen.
Corrected this and cleaned up a bit the entire file, removing
duplicate lines and regrouping lines.

Added also ignoring generated .cpp files in
qucs/qucs-core/src/components/verilog/
To extract the goals variables values from the output dataset,
Qucs writes some files in the extract/ directory defining, among other
things, the text string to search in the dataset to locate the variable.
ASCO does a SUBstring match, so the search string need also to contain
the string delimiter (a trailing space), otherwise it will match any
ither string starting with the same characters.
@in3otd in3otd added this to the 0.0.19 milestone Feb 18, 2016
@in3otd
Copy link
Contributor Author

in3otd commented Feb 18, 2016

added the 0.0.19 label - at least for the 03fef76 bug fix, the other commits can go in develop if you prefer.

@guitorri
Copy link
Member

Merged into release-0.0.19 (0e279af). Thank you.

@guitorri guitorri closed this Feb 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants