Skip to main content

The myscop is wrapper of SCOP.

SCOP is Solver for COnstraint Programing.

Need scop and scop.py.

https://logopt.com/scop2/

Example(bin packing)

from myscop import MyModel, MyLinear as L

items = [6, 5, 4, 3, 1, 2]  # item size
num_bins = 3  # bin size
m = MyModel()
vv = m.addvars(len(items), range(num_bins))
for b in range(num_bins):
    m.addcons(L(items, vv, b) <= 7)
m.optimize()
ans = [v.value for v in vv]
print(ans)  # ['2', '0', '1', '1', '2', '0']

Example(alldiff & quadratic)

from myscop import inf, MyModel, MyAlldiff as A, MyQuadratic as Q

m = MyModel()
m.Params.TimeLimit = 0.1
x, y, z = m.addvars(3, range(3))
m.addcons(A([x, y, z]), weight=inf)
for i, j in [(0, 1), (0, 2), (1, 0), (1, 2), (2, 0), (2, 1)]:
    for v1, v2 in zip([x, x, y], [y, z, z]):
        if v1 == x and v2 == y and i == 1 and j == 0:
            continue
        m.addcons(Q(1, [v1], i, [v2], j) <= 0)
m.optimize()
ans = [v.value for v in [x, y, z]]
print(ans)  # ['1', '0', '2']

Metadata

Release files for myscop 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for myscop 0.0.8
File Interpreter ABI Platform Actions
myscop-0.0.8-py3-none-any.whl Python 3 none any Details for myscop-0.0.8-py3-none-any.whl

Release files / myscop-0.0.8-py3-none-any.whl

Download URL myscop-0.0.8-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49af782f4467165a39046d0f088c8f2f735ae7d7b68c7c791ab488214a64f744
BLAKE2b-256 checksum
How to use checksums
5ea6eb226e53658c35d4b745b0689b129aa13d2587a2fb73e5e0c4e8baeaa82f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.6 Darwin/19.6.0

Security for myscop 0.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page