How to formulate the LP problem and solve it in CPLEX using a set (ranges) [closed] - arrays

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 days ago.
Improve this question
Exercise question:
Resource data table:
The Dakota Furniture Company manufactures desks, tables, and chairs. The manufacture of each type of furniture requires lumber and two types of skilled labor: finishing and carpentry.
The amount of each resource needed to make each type of furniture is given in Table 2.
Currently, 48 board feet of lumber, 20 finishing hours, and 8 carpentry hours are available.
A desk sells for $60, a table for $30, and a chair for $20.
Dakota believes that demand for desks and chairs is unlimited, but at most five tables can be sold.
Because the available resources have already been purchased, Dakota wants to maximize total revenue
My current code:
MAX OBJECTIVE VALUE Z SHOULD BE 280 WITH x1=2, x2=0, x3=8
BUT I AM GETTING Z = 180.

What is this supposed to mean:
forall (i in I, j in J)
sum(j in J) x[i][j] <= S[i];
Similar for the other constraints.
You may want to generate an LP file to see what OPL is actually generating. It is likely different from what you think.
OPL should really not accept this kind of input.

Related

Google sheets - calculating price from multiple dropdown selections [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 months ago.
The community reviewed whether to reopen this question 6 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I would like to calculate the total price in column N (Materials Price) based on the multiple dropdown selections in column M (Materials). How would I accomplish this? The materials and corresponding pricing are in the "price sheet" tab.
For example, in cell M7 there are 3 materials listed: Rollers 10,7 Foot Cable,Side Plates. I would like the total price of $51 to appear in cell N7,
Thank you in advance...I'm new to this so I hope my question is clear.
https://docs.google.com/spreadsheets/d/1RxUrdl-qsMmz84YELN_aNWgYT8q6fOMwiLMO2XgRviU/edit?usp=sharing
try:
=ARRAYFORMULA(MMULT(IFNA(VLOOKUP(SPLIT(M7, ","), 'Price Sheet'!A:B, 2, 0), 0),
SEQUENCE(COLUMNS(SPLIT(M7, ",")), 1, 1, 0)))
you can even replace cell reference with a column range and get whole column by one formula

Binary classification of sensor data using minimal code space [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am trying to classify the events above as 1 or 0. 1 would be the lower values and 0 would be the higher values. Usually the data is does not look as clean as this. Currently the approach I am taking is to have two different thresholds so that in order to go from 0 to 1 it has to go past the 1 to 0 threshold and it has to be above for 20 sensor values. This threshold is set to the highest value I receive minus ten percent of that value. I dont think a machine learning approach will work because I have too few features to work with and also the implementation has to take up minimal code space. I am hoping someone may be able to point me in the direction of a known algorithm that would apply well to this sort of problem, googling it and checking my other sources isnt producing great results. The current implementation is very effective and the hardware inst going to change.
Currently the approach I am taking is to have two different thresholds so that in order to go from 0 to 1 it has to go past the 1 to 0 threshold and it has to be above for 20 sensor values
Calculate the area on your graph of those 20 sensor values. If the area is greater than a threshold (perhaps half the peak value) assign it as 1, else assign it as 0.
Since your measurements are one unit wide (pixels, or sensor readings) the area ends up being the sum of the 20 sensor values.

Simple Reshape of a 9061x16 into 6x24x??x16 (4D). Data included, [MATLAB] [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i have a matrix og 9061x16 i want to reshape to 6x24x??x16. currently the 9061x16 explains this: 16 is the amount of customers.. and 9061 is how much data each customer have.
What i want from the reshape:
since the data is collected every 10 min. for a duration of 62 days and some hours which the ?? is. Since in 1 hour there is collected 6 data. the matrix will therefore be like 6x24xdaysx16..
please do help i really need this :(.
the x.mat is what i reshaped 9061x16 from the V.mat
(The data can be downloaded from this post: Data of x.mat and v.mat
You could extend x to a number of rows multiple of 6*24, and then use reshape:
x(ceil(size(x,1)/144)*144, end) = 0; %// extend x, filling with zeros
x = reshape(x, 6, 24, [], 16); %// reshape x into desired form

Which are admissible heuristics and why? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
There are n vehicles on an n x n grid. At the start they are ordered in the top row 1. The vehicles have to get to the bottom row such that the vehicle at (1,n) must get to (n, n − i + 1). On each time step, each of the vehicles can move one square up, down, left or right, or it can stay put. If the vehicle stays put, one adjacent vehicle (but not more than one) can hop over it. Two vehicles cannot occupy the same square.
Which of the following heuristics are admissible for the problem of moving all the vehicles to their destination?
i. sum from 1 to n (h1 ... hn)
ii. max(h1 ... hn)
iii. min(h1 ...hn)
I think that iii is the only correct one, but I'm not sure how to formulate my reasoning on why.
I am sure someone will come along with a very detailed answer, but as a favour to those who like me can be a bit overwhelmed by all things AI, an admissible heuristic is quite simply:
A heuristic that never overestimates the true cost of getting to the goal
Not to sound too uncharitable, but it sounds as if maybe the problems you've posted are from a homework problem or assignment. I wouldn't want to spoil your fun working out exactly which of those three heuristics are and aren't admissible - but hopefully that one sentence definition should help you along.
If you get confused, just remember: if once your vehicles have both reached their goals you find the actual cost was less than what the heuristic thought it would be then it's inadmissable.

Estimating database size [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I was wondering what you do when developing a new application in terms of estimating database size.
E.g. I am planning to launch a website, and I am having a hard time estimating what size I could expect my database to grow. I don't expect you to tell me what size my database will be, but I'd like to know if there are general principles in estimating this.
E.g. When Jeff developed StackOverflow, he (presumably) guesstimated his database size and growth.
My dilemma is that I am going for a hosted solution for my web application (its about cost at this stage), and preferably don't want to shoot myself in the foot by not purchasing enough SQL Server space (they charge a premium for this).
If you have a database schema, sizing is pretty straightforward ... it's just estimated rows * avg row size for each table * some factor for indexes * some other factor for overhead. Given the ridiculously low price of storage nowadays, sizing often isn't a problem unless you intend to have a very high traffic site (or are building an app for a large enterprise).
For my own sizing exercises, I've always created an excel spreadsheet listing:
col 1: each table that will grow
col 2: estimated column size in bytes
col 3: estimated # of rows (per year or max, depending on application)
col 4: index factor (I always set this to 2)
col 5: overhead factor (I always set this to 1.2)
col 6: total column (col 2 X 3 X 4 X 5)
The sum of col 6 (total column), plus the initial size of your database without growth tables, is your size estimate. You can get much more scientific, but this is my quick and dirty way.
Determine:
how many visitors per day, V
how many records of each type will be created per visit, N1, N2, N3...
the size of each record type, S1, S2, S3...
EDIT: forgot index factor which a good rule of thumb is 2 times
Total growth per day = 2* V * (N1*S1 + N2*S2 + N3*S3 + ...)
My rules-of-thumb to follow are
how many users do I expect?
what content can they post?
how big is a user record?
how big is each content item a user can add?
how much will I be adding?
how long will those content items live? forever? just a couple weeks?
Multiply the user record size times the number of users; add the number of users times the content item size; multiply by two (for a convenient fudge factor).
The cost of estimating is likely to be larger than the cost of the storage
Most hosting providers sell capacity by the ammount used at the end of each month, so just let it run

Resources