Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9210217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:01:11+00:00 2026-06-18T01:01:11+00:00

I am writing a linear program in LINGO to balance a drum using a

  • 0

I am writing a linear program in LINGO to balance a drum using a minimum number of weights. My question is how do I limit a variable to a set of values? For example, if I wanted a variable called Weight to be limited to the values (0, 1, 2, 4, 5, or 10) how could I achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:01:12+00:00Added an answer on June 18, 2026 at 1:01 am

    The usual way to achieve this is by introducing several binary (0,1) indicator variables into the formulation.

    Let’s say that X is the variable of interest and it can take discrete values {0,1,2,4,5, 10}
    Introduce six indicator variables (Y_0, Y_1, … Y_10)
    We only want one of these Y’s to take on the value of 1, everything else to be 0.

    Y_0 + Y_1 + Y_2 + Y_4 + Y_5 + Y_10 = 1 (Mutual exclusivity constraint)

    Now tie the indicator variables with the Original variable.

    X = 0 Y_0 + 1 Y_1 + 2 Y_2 + 4 Y_4 + 5 Y_5 + 10 Y_10
    (X will take on the appropriate value depending on which indicator variable is 1.)

    Now use X in the rest of your formulation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing a python program, and I came up with this error while using the
I am writing a simple Python program. My program seems to suffer from linear
I have been writing linear winforms for couple of months and now I am
I'm writing a LabVIEW VI to move a Zaber linear actuator, and I want
Writing an asynchronous Ping using Raw Sockets in F#, to enable parallel requests using
I'm writing a simple linear linked list implementation in PHP. This is basically just
I am writing a program in C++ which uses the CLAPACK ATLAS library. However,
I'm writing a program which has two main phases: determining the region of interest,
I was writing code for something like an array with variable dimensions. What I
I have a question in my mind from last many days, that while writing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.