Skip to content

Fuinn/mos-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mos-examples

Optimization model examples ready for use with MOS.

Examples are arranged by modeling system (e.g. CVXPY, JuMP). Associated with each example are two file types, *model.* and *test.*, along with any data files associated with the example.

The *test.* files provide examples of how to access, adjust, and solve models via API and the MOS Interface packages.

Feel free to contact us with any queries.

Application areas

Examples from:

Use with MOS Frontend

The *model.* example may be uploaded to MOS Frontend directly, ready to be provided with mos-examples data or user data, and solved.

Use with MOS Interface packages

Steps to use with the MOS Python Interface package or Julia Interface package:

  • Installation of an MOS Interface package
  • Adjustment of an *test.* file to include URL and authentication token
  • Alternatively, setting of local environment variables will allow use of an *test.* file directly
  • The key environment variable to set is: MOS_BACKEND_TOKEN. If hosting MOS locally, the environment variables MOS_BACKEND_HOST, MOS_BACKEND_PORT, are also required to be set.
  • If the environment variables are set in a file named .env at the root of the repository, the api examples will automatically load them.

The model may then be specified, adjusted, and solved through the *test.* file, from the repository root, to the user's interest.

Running All Models as Tests

We assume here that MOS is running and that the necessary environment variables have been defined for using MOS via the Python and Julia interfaces.

For Python, install pytest and the MOS Python interface, and execute the following command from the root directory of the mos-examples repository:

pytest -v --show-capture=no

For Julia, install the MOS Julia interface, and execute the following command from the root directory of the mos-examples repository:

julia runtests.jl

Contributing

Contributions of new and improved models are very welcome.

  1. Fork the Project
  2. Create your Branch (git checkout -b NewModel)
  3. Commit your Changes (git commit -m 'New Model')
  4. Push to the Branch (git push origin NewModel)
  5. Open a Pull Request

License

Distributed under the BSD-3-Clause License. See LICENSE for more information.

About

Optimization model examples ready for use with MOS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •