Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@taiseiKMC
Copy link
Owner

Link to the corresponding issue (if exists)

Summary of the changes

  • What is done by this PR

Check list

  • Are the contributors appropriately acknowledged?
    • in the README.md
    • in the code as JavaDoc comments
  • Is the corresponding paper listed in the README.md (if exists)?
  • Is the new functionality tested by unit test?
    • Please also consider using junit-quickcheck for property-based testing if possible.

Other Notes (if exists)

  • Other important information

@taiseiKMC taiseiKMC requested a review from MasWag as a code owner July 9, 2025 16:19
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @taiseiKMC, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a Python-wrapped MATLAB Simulink model into the FalCAuN framework, enabling the verification of Simulink models using adaptive STL learning. It includes a Kotlin example demonstrating the integration, a Python implementation of the SUL, and enhancements to the Java code to support batch processing of input signals for improved performance. Additionally, new tests have been added to ensure the functionality of the new features.

Highlights

  • Kotlin Example: Added a new Kotlin script ATS1-python.kts that demonstrates the usage of FalCAuN-core and FalCAuN-python with a Python-wrapped Simulink model. This script sets up an automatic transmission model, defines STL properties, and runs verification using GA-based equivalence testing.
  • Python SUL Implementation: Created a Python script autotrans_matlab.py that wraps a Simulink model for automatic transmission control. It includes classes for signal handling and Simulink interaction, providing a System Under Learning (SUL) interface compatible with FalCAuN.
  • PythonModel Enhancement: Modified PythonModel.java to include an optional exec method for batch processing of input signals. This allows for more efficient execution when the Python model provides an exec function.
  • NumericSUL Update: Updated PythonNumericSUL.java to utilize the exec method in the Python model if available, improving performance by processing input signals in batches instead of one at a time.
  • Testing Improvements: Added a new test case numericExecuteTest2 in PythonNumericSULTest.java to verify the functionality of the exec method in the Python model. Also, a new python script test_numeric_sul_with_exec.py was added to support this test.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a Python-wrapped MATLAB SUL and integrates it into the existing framework. A key addition is the exec method for batch processing of inputs, which is a good performance optimization. The changes also include a new Kotlin example script demonstrating the usage with an automatic transmission model.

"""

(t, y) = self.simulinkModel.step(inputSignal)
y = np.array(y[0], dtype=np.float64)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The simulinkModel.step() method can return an empty list for y. In such cases, accessing y[0] will raise an IndexError. You should add a check to handle an empty y before accessing its elements. This same vulnerability exists in the exec method on line 312.

Suggested change
y = np.array(y[0], dtype=np.float64)
(t, y) = self.simulinkModel.step(inputSignal)
if not y:
return []
y = np.array(y[0], dtype=np.float64)

Comment on lines +289 to +288
signalStep = 1.0
simulinkSimulationStep = 0.0025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The signalStep and simulinkSimulationStep values are hardcoded. The Java/Kotlin PythonContinuousNumericSUL is initialized with a signalStep, but this value is not passed down to this Python SUL. This can lead to inconsistencies and unexpected behavior if the values differ.

@taiseiKMC taiseiKMC force-pushed the hsaito/python-wrapped-matlab branch from 690a5a7 to 672c52d Compare July 9, 2025 16:45
@taiseiKMC
Copy link
Owner Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a Python-wrapped MATLAB SUL (System Under Learning) and integrates it into the FalCAuN framework. The key change is adding an exec method for batch processing of signals, which is a significant performance optimization. The changes span across Java, Kotlin, and Python, including new example scripts and tests. I focused on improving code clarity, maintainability, and idiomatic usage of language features in Kotlin and Python.

Comment on lines +21 to +32
var updaterLogger = LoggerFactory.getLogger(AbstractAdaptiveSTLUpdater::class.java) as Logger
updaterLogger.level = Level.INFO
var updateListLogger = LoggerFactory.getLogger(AdaptiveSTLList::class.java) as Logger
updateListLogger.level = Level.INFO
var LTSminVersionLogger = LoggerFactory.getLogger(LTSminVersion::class.java) as Logger
LTSminVersionLogger.level = Level.INFO
var AbstractLTSminLogger = LoggerFactory.getLogger(AbstractLTSmin::class.java) as Logger
AbstractLTSminLogger.level = Level.INFO
var EQSearchProblemLogger = LoggerFactory.getLogger(EQSearchProblem::class.java) as Logger
EQSearchProblemLogger.level = Level.INFO
var SimulinkSteadyStateGeneticAlgorithmLogger = LoggerFactory.getLogger(EQSteadyStateGeneticAlgorithm::class.java) as Logger
SimulinkSteadyStateGeneticAlgorithmLogger.level = Level.INFO

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logger level setting is repetitive. Consider using a loop for conciseness and maintainability.

listOf(
    AbstractAdaptiveSTLUpdater::class.java,
    AdaptiveSTLList::class.java,
    LTSminVersion::class.java,
    AbstractLTSmin::class.java,
    EQSearchProblem::class.java,
    EQSteadyStateGeneticAlgorithm::class.java
).forEach { (LoggerFactory.getLogger(it) as Logger).level = Level.INFO }

val verifier = NumericSULVerifier(autoTransSUL, signalStep, properties, mapper)
// Timeout must be set before adding equivalence testing
verifier.setTimeout(60 * 40) // 40 minutes
verifier.addCornerCaseEQOracle(signalLength, signalLength / 2);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Remove the trailing semicolon for idiomatic Kotlin.

    verifier.addCornerCaseEQOracle(signalLength, signalLength / 2)

Comment on lines +94 to +99
for (i in 0 until verifier.cexProperty.size) {
println("${verifier.cexProperty[i]} is falsified by the following counterexample")
println("cex concrete input: ${verifier.cexConcreteInput[i]}")
println("cex abstract input: ${verifier.cexAbstractInput[i]}")
println("cex output: ${verifier.cexOutput[i]}")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using forEachIndexed for more idiomatic Kotlin.

        verifier.cexProperty.forEachIndexed { i, property ->
            println("$property is falsified by the following counterexample")
            println("cex concrete input: ${verifier.cexConcreteInput[i]}")
            println("cex abstract input: ${verifier.cexAbstractInput[i]}")
            println("cex output: ${verifier.cexOutput[i]}")
        }

simulinkModel : SimulinkModel
MDL = "Autotrans_shift"

def initScript(eng : matlab.engine.MatlabEngine) -> None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Add @staticmethod decorator since initScript doesn't use self or cls.

    @staticmethod
    def initScript(eng : matlab.engine.MatlabEngine) -> None:

dependabot bot and others added 24 commits August 4, 2025 22:29
Bumps [org.apache.maven.plugins:maven-dependency-plugin](https://github.com/apache/maven-dependency-plugin) from 3.8.0 to 3.8.1.
- [Release notes](https://github.com/apache/maven-dependency-plugin/releases)
- [Commits](apache/maven-dependency-plugin@maven-dependency-plugin-3.8.0...maven-dependency-plugin-3.8.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-dependency-plugin
  dependency-version: 3.8.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [org.hibernate.validator:hibernate-validator](https://github.com/hibernate/hibernate-validator) from 8.0.2.Final to 9.0.1.Final.
- [Changelog](https://github.com/hibernate/hibernate-validator/blob/9.0.1.Final/changelog.txt)
- [Commits](hibernate/hibernate-validator@8.0.2.Final...9.0.1.Final)

---
updated-dependencies:
- dependency-name: org.hibernate.validator:hibernate-validator
  dependency-version: 9.0.1.Final
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [org.jacoco:jacoco-maven-plugin](https://github.com/jacoco/jacoco) from 0.8.12 to 0.8.13.
- [Release notes](https://github.com/jacoco/jacoco/releases)
- [Commits](jacoco/jacoco@v0.8.12...v0.8.13)

---
updated-dependencies:
- dependency-name: org.jacoco:jacoco-maven-plugin
  dependency-version: 0.8.13
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](apache/maven-surefire@surefire-3.5.2...surefire-3.5.3)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-version: 3.5.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.1.2 to 5.4.3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v5.1.2...v5.4.3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: 5.4.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [commons-cli:commons-cli](https://github.com/apache/commons-cli) from 1.9.0 to 1.10.0.
- [Changelog](https://github.com/apache/commons-cli/blob/master/RELEASE-NOTES.txt)
- [Commits](apache/commons-cli@rel/commons-cli-1.9.0...rel/commons-cli-1.10.0)

---
updated-dependencies:
- dependency-name: commons-cli:commons-cli
  dependency-version: 1.10.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps `junit.jupiter.version` from 5.12.0 to 5.13.4.

Updates `org.junit.jupiter:junit-jupiter-api` from 5.12.0 to 5.13.4
- [Release notes](https://github.com/junit-team/junit-framework/releases)
- [Commits](junit-team/junit-framework@r5.12.0...r5.13.4)

Updates `org.junit.jupiter:junit-jupiter-engine` from 5.12.0 to 5.13.4
- [Release notes](https://github.com/junit-team/junit-framework/releases)
- [Commits](junit-team/junit-framework@r5.12.0...r5.13.4)

Updates `org.junit.vintage:junit-vintage-engine` from 5.12.0 to 5.13.4
- [Release notes](https://github.com/junit-team/junit-framework/releases)
- [Commits](junit-team/junit-framework@r5.12.0...r5.13.4)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter-api
  dependency-version: 5.13.4
  dependency-type: direct:development
  update-type: version-update:semver-minor
- dependency-name: org.junit.jupiter:junit-jupiter-engine
  dependency-version: 5.13.4
  dependency-type: direct:development
  update-type: version-update:semver-minor
- dependency-name: org.junit.vintage:junit-vintage-engine
  dependency-version: 5.13.4
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [black.ninia:jep](https://github.com/ninia/jep) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/ninia/jep/releases)
- [Commits](ninia/jep@v4.2.1...v4.2.2)

---
updated-dependencies:
- dependency-name: black.ninia:jep
  dependency-version: 4.2.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fixed a bug in TemporalRelease

* Update core/src/main/java/net/maswag/falcaun/TemporalRelease.java

Co-authored-by: Copilot <[email protected]>

* Update core/src/test/java/net/maswag/falcaun/STLReleaseTest.java

Co-authored-by: Copilot <[email protected]>

* Fixed a compilation error

* Not fix the version of Python in CI

---------

Co-authored-by: Copilot <[email protected]>
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.18.0 to 5.19.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](mockito/mockito@v5.18.0...v5.19.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-version: 5.19.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.27.3 to 3.27.4.
- [Release notes](https://github.com/assertj/assertj/releases)
- [Commits](assertj/assertj@assertj-build-3.27.3...assertj-build-3.27.4)

---
updated-dependencies:
- dependency-name: org.assertj:assertj-core
  dependency-version: 3.27.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
MasWag and others added 18 commits August 17, 2025 17:58
Bumps [net.bytebuddy:byte-buddy](https://github.com/raphw/byte-buddy) from 1.17.6 to 1.17.7.
- [Release notes](https://github.com/raphw/byte-buddy/releases)
- [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
- [Commits](raphw/byte-buddy@byte-buddy-1.17.6...byte-buddy-1.17.7)

---
updated-dependencies:
- dependency-name: net.bytebuddy:byte-buddy
  dependency-version: 1.17.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.11.2 to 3.11.3.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](apache/maven-javadoc-plugin@maven-javadoc-plugin-3.11.2...maven-javadoc-plugin-3.11.3)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-version: 3.11.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Remove an unused variable
@taiseiKMC taiseiKMC force-pushed the hsaito/python-wrapped-matlab branch from df3d0fa to c61e88a Compare August 24, 2025 17:20
FalCAuN Examples with Scala
============================

This directory contains examples to directly execute FalCAuN via Scala. Our examples depends on [scala-cli](https://scala-cli.virtuslab.org/). We tested these examples using Scala 3.7.2 and Scala CLI 1.8.5.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LanguageTool] reported by reviewdog 🐶
You should probably use “depend”. (AGREEMENT_SENT_START[1])
Suggestions: depend
URL: https://languagetool.org/insights/post/grammar-subject-verb-agreement/#4-collective-nouns-can-be-singular-or-plural
Rule: https://community.languagetool.org/rule/show/AGREEMENT_SENT_START?lang=en-US&subId=1
Category: GRAMMAR

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

Successfully merging this pull request may close these issues.

3 participants